FRIHOSTFORUMSSEARCHFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

.htaccess... Somebody help me!

 


richard270384
I have a .htaccess file with the following lines:
Code:
Options +FollowSymlinks

ErrorDocument 404 /file-not-found


RewriteEngine on

RewriteRule ^file-not-found/?$ index.php?a=file_not_found
RewriteRule ^database-error/?$ index.php?a=database_error
RewriteRule ^privacy-policy/?$ index.php?a=privacy_policy
RewriteRule ^disclaimer/?$ index.php?a=disclaimer
RewriteRule ^conditions-of-use/?$ index.php?a=conditions_of_use
RewriteRule ^contact-us/?$ index.php?a=contact_us
RewriteRule ^not-authorised/?$ index.php?a=not_authorised
RewriteRule ^thanks/?$ index.php?a=thankyou

RewriteRule ^google-search/?$ index.php?a=google_search


Can somebody please tell me why:

site.com/disclaimer correctly works
site.com/disclaimer/ correctly works

but

site.com/thanks redirects to site.com/thanks/?a=thankyou (which is wrong)
site.com/thanks/ correctly works

????

I hope it makes sense what I am asking.

The redirect for the 'thanks' file is the only line in the file that doesn't redirect in the way I want it to, but it is essentially exactly the same as every other line.

Cheers,
Richard
b4r4t
Try to add [L] flag to each redirect, sometimes it helps Smile
You "tell" to your server that if match in htacces was found - redirect and don't read other rules Smile
albuferque
Add this to your htaccess:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://site.com/$1/ [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f makes shure that files that are existing will not get a slash added. You shouldn't do the same with directories since this would exlude the rewrite behaviour for existing directories.

The condition RewriteCond %{REQUEST_URI} !(.*)/$ finally fires when a urls doesn't contain a trailing slash - this is all what we want. Now we need to redirect these url with the trailing slash:

RewriteRule ^(.*)$ http://site.com/$1/ [L,R=301] does the 301 redirect to the url with the trailing slash appended for us. You should replace site.com with your url

Hope it helps.
Related topics

Need help.. I don't Know wats the problem but plz help me
Help In Php-nuke
Phpbb upgrade to 2.01.8.. can somebody help me with that
Can somebody help me to make my site interactive
CAN SOMEONE HELP? I DON'T UN DERSTAND HOW TO UPLOAD WEBSITE!

Help with SimplePHPblog
SOS Guys I realy need ur help!
JavaScript Help
Is Joomla/Mambo safe???
Need help in installing phpBB

help with call of duty 4
HELP! My account unactivated itself!!!!!
I specifying end my site!Please somebody help me!
Monetize You Website or Blog
HELP!!!
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.