|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
URL Rewriting using Apache Rewrite Engine
Hello!
NEED HELP IN A BIG WAY!!! I am trying out search engine friendly URL's. I have rid my URL's of the "?" and "&". I have done this using several methods, such as, 1. <Files script> ForceType application/x-httpd-php </Files> 2. RewriteEngine on RewriteBase / RewriteRule ^script script.html 3. Alias /script script.html They all work great in the way that you can navigate around my site very easily BUT for some reason cookies or sessions don't work witht his method. Has anyone run into this? Check this out! When I run a phpinfo() script, one under "/script/" (such as http://yourdomain/script/phpinfo.php) and one not under "/script/" (such as http://yourdomain/phpinfo.php) the PHP Environment variables are different. Here is some of the phpinfo() file that is NOT run through the script.php (i.e. http://yourdomain/phpinfo.php) .... ------------------------------------------------------------------------ "HTTP HEADERS INFORMATION" HTTP Request GET /html/phpinfo.html HTTP/1.1 Accept image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, */* Accept-Language en-us Cache-Control bypass-client=215.223.170.222 Connection keep-alive Cookie cookie=2 Host www.yourdomain.com User-Agent Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.0) Via 1.1 wccp4 X-Forwarded-For 215.223.170.222 HTTP Response Headers X-Powered-By PHP/4.0.6 Set-Cookie PHPSESSID=0df0f18584987417bdc4798f7df2c944; path=/ Expires Thu, 19 Nov 1981 08:52:00 GMT Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma no-cache Keep-Alive timeout=15, max=100 Connection Keep-Alive Transfer-Encoding chunked Content-Type text/html ---------------------------------------------------------------------------- and...here is some of the phpinfo() file that is run through the script.php (i.e. http://yourdomain/script/phpinfo.php) -------------------------------------------------------------------------- "HTTP HEADERS INFORMATION" HTTP Request GET /html/phpinfo.html HTTP/1.0 Host www.yourdomain.com User-Agent PHP/4.0.6 HTTP Response Headers X-Powered-By PHP/4.0.6 Set-Cookie PHPSESSID=4f5768dac97cb3121b78ec6649e044d1; path=/ Expires Thu, 19 Nov 1981 08:52:00 GMT Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma no-cache Connection close Content-Type text/html ------------------------------------------------------------------------------ The rest of the phpinfo() files are quite different as well and I can supply you with more if you need to see it. It looks like, from comparing these files, that when a phpinfo() file falls under "/script/" it reads from the server itself. I just don't know enough about Apache to understand this. Can anyone help me resolve this problem? I know this method works. Is it my hosting service? I host at JTLNET.com. Has anyone had this problem with them? Thank you in advance, Piet
__________________
![]() - Please help us build our Hewlett Packard community - Check us out, or tell someone who might find us useful Last edited by piet : April 7th, 2003 at 03:35 PM. |
|
#2
|
|||
|
|||
|
Start here -> http://httpd.apache.org/docs/mod/mo...tml#RewriteBase
Try not to use RewriteBase at all and see if it makes any difference. |
|
#3
|
|||
|
|||
|
freebsd:
No luck! For some reason all the methods I try produce the same results. I tried your suggestion with no RewriteBase see (2.a below) and even tried another... 2.a. RewriteEngine on RewriteRule ^script script.html 4. DirectoryIndex script ForceType application/x-httpd-php I find this quite odd since many websites do rely on this method and I am sure they use cookies and sessions too. Have you run into this behavior before? Do you have any other suggestions? I am desperate at this point since I rely on this method for my site to work. Is it my hosting company (http://www.jtlnet.com)? Do they have something to do with this? Any more help will be greatly appreciated. Piet Last edited by piet : April 7th, 2003 at 03:35 PM. |
|
#4
|
|||
|
|||
|
Maybe you should do a search in this forum and try out my php's searchengine-friendly examples.
|
|
#5
|
|||
|
|||
|
freebsd:
You are quite a prolific poster and I appreciate you taking the time to help me out. To anyone one else...I still have NOT figured this one out. Is there something wrong with my .htaccess file? Check out the user-agent in my original message...it seems that when phpinfo() is run through my "script.php" the user-agent is PHP/4.0.6 and not the client (Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.0) as one would suspect. Anyone with some advice? Piet Last edited by piet : April 7th, 2003 at 03:36 PM. |
|
#6
|
|||
|
|||
|
Because there was an internal process in between which phpinfo was in responding to, rather than the originated request.
|
|
#7
|
|||
|
|||
|
freebsd:
I figured that was what was going on. So does this mean that this technique can't use cookies or sessions? Why is everyone so interested in this method then? I can't imagine websites wanting to deploy this method just for friendly URLs when they forgo the usefulness of cookies and sessions. AND BESIDES...it works perfectly fine on my development server (WIN2000, Apache 1.3.14, PHP 4.0.5, MySql)!!!! freebsd...you have helped enough. If you can figure out the solution for this then I would be psyched but you don't need to. If anyone esle has run into this and has the solution then please post it. Much thanks, Piet Last edited by piet : April 7th, 2003 at 03:36 PM. |
|
#8
|
|||
|
|||
|
Maybe you should try this one -> http://forums.devshed.com/showthrea...8938&forumid=15 and ask jizzaz for solutions. I am sure he should already came up with some info.
Don't forget to ask forefront, too. He was the very first one who came up or discovered this "userfriendly-url for dynamic PHP" idea back in last year (the longest thread in this forum). I don't code PHP at all. If you ask me something like hello world php script, sure I would know about that. I just provided the rules for mod_rewrite, anything behind the sense that has to do with PHP, I don't have a clue. |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > URL Rewriting using Apache Rewrite Engine |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|