PDA

View Full Version : SEO - Remove /index.php --> /


jw00dy
09-09-2008, 07:20 PM
I've got the .htaccess uploaded and modified slightly (added non-www redirect to www), but I'd like to redirect all the URLs so they don't include the index.php on the end of the URL.

Desired URL: domain.com/links/
Current URL: domain.com/links/index.php

Rather than changing all the templates to remove this, I'm wondering if you have any brilliant ideas on how I can rewrite this and probably more importantly, preserve the session stuff.

I am not concerned with the URL's that I will block with my robots.txt, which will include pretty much anything (search.php, misc.php, etc) other than the normal directory of links.

Your help is greatly appreciated.

jw00dy
09-10-2008, 04:41 AM
Got it.

For those interested in redirecting index.php and index.php?whatever you can add this to your .htaccess in the root of your link dir.

RewriteCond %{THE_REQUEST} index\.php
RewriteRule ^index\.php http://www.YOURDOMAIN.com/links/? [L,R=301]

Be sure to replace the YOURDOMAIN part (including the www if you don't use it and the .com if you TLD is different). And of course change links to something else if you put your LD in a different directory (make it match).

Hope that helps.