force or remove trailing slash: duplicate cache issue |
[eluser]oliverkalen[/eluser]
I would like to force consistency in my URI's to prevent duplicate cache entries http://website.com/uri/here http://website.com/uri/here/ Visiting both of these pages will create 2 separate cache entries. My mod_rewrite in htaccess currently looks like: RewriteEngine On RewriteBase /baseurl/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] Is there a mod_rewrite solution to this? or will it need to be done through CI? I can deal with/without the trailing slash - whichever is easier. Thanks!
[eluser]Ignacio[/eluser]
I have the same issue. http://website.com/uri/here -> cache (not by CI) http://website.com/uri/here/ -> no cache, works fine! ![]()
[eluser]Ignacio[/eluser]
I fix this disabling eAccelerator. But I'm not completely sure if this is the best/right solution, but without eAccelerator, the problem is gone. (Sent with my iphone in bed)
[eluser]Leevi Graham[/eluser]
I implemented this for ExpressionEngine and it seems to be doing the trick. # Add Slash RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(.*)/$ RewriteCond $1 ^(members|contact|cms-customisation|site|ee-support|wp-content|P[0-9]{2,8}) [NC] RewriteRule ^(.*)$ $1/ [L,R=301] Basically if its not a file, directory or one of my template groups I redirect to the exact same thing with a trailing slash.
[eluser]mania[/eluser]
I think I have this working to both force a trailing slash and get rid of the index.php but can someone explain what I did here by trial and error? I am pretty sure its important to not have multiple options on how to get to a page for SEO etc. Code: <IfModule mod_rewrite.c>
[eluser]Leon Stafford[/eluser]
I got rid of my trailing slashes with the above examples, but then it broke my FreakAuth Light login.... ![]()
[eluser]danoph[/eluser]
I've been looking for a solution for a while now, and this one works perfectly on my mediatemple server hosting http://graphicleftovers.com (built in codeigniter + wordpress for blog), as is without any editing: Code: <IfModule mod_rewrite.c> Thanks a lot @mania!
[eluser]RaZoR LeGaCy[/eluser]
Sorry to bring this thread back but: http://www.example.com/example works and goes to http://www.example.com/example/ http://www.example.com/example.html breaks How do I fix this?
[eluser]danoph[/eluser]
What error do you receive when you try to visit example.html? Most likely the file doesn't exist... |
Welcome Guest, Not a member yet? Register Sign In |