Page 2 of 2

Posted: Sat Jul 29, 2006 8:04 am
by tecktalkcm0391
This still isn't working even if I go to US/New York it doens't work. and its suppost to because if i go to us.php?state=New York... it does work and shows the page.

Also with the .php if i go to anypage and then remove the .php it still doens't show up anything. I get a 404 error.

Posted: Sat Jul 29, 2006 9:56 pm
by RobertGonzalez
tecktalkcm0391 wrote:This still isn't working even if I go to US/New York it doens't work. and its suppost to because if i go to us.php?state=New York... it does work and shows the page.

Also with the .php if i go to anypage and then remove the .php it still doens't show up anything. I get a 404 error.

Code: Select all

ErrorDocument 401 error.php?error=401
ErrorDocument 403 error.php?error=403
ErrorDocument 404 error.php?error=404
ErrorDocument 500 error.php?error=500

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [S=2]
RewriteRule ^us/([A-Z]+)$ us.php?state=$1 [nocase]
RewriteRule ^(.+)/$ $1.php [QSA,L]
# The above line expects a trailing slash.
# It wont work the same without the slash
Try the one above. Take note that the trailing slash will affect the rewriting, so if you go to http://www.mysite.com/somepage/ the server should load http://www.mysite.com/sompage.php. But if you go to http://www.mysite.com/somepage, the server will look for the folder.