Hello, At the moment I have this... RewriteEngine on RewriteRule ^(profile|biography|schedule|quotes|career|results|suggestpoll|media|mobile|advertise|about|team|links)(/)?$ $1.php [L] Please can someone modify this so that I don't need to specify each page in the code but instead it will automatically know to find the related .php page based on what you type /here/ ? Thanks in advance
Thanks a lot but now when you go to a page that is within a real directory, it gives a 404..? So is there a way to exclude a couple of directories?
Add a RewriteCond to check if the file/dir exists, or use a directory name that has something besides the alphabet (i.e. my-images or _images). Jay
RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^([a-z]+)/?$ $1.php [L] Code (markup):
Thank you but there's a slight problem with the code, when there is a php file with a '-' in it, it will give a 404. /page/ works /page-page/ 404
The regex only matches a-z. If you want it to include a dash then add it in. RewriteRule ^([a-z-]+)/?$ $1.php [L] Code (markup):
After I implemented this, within days my sub-pages started completely vanishing from Google when they previously were #1-4. I've now put back my original .htaccess.