0

The other day my boss noticed that our php pages read, and try to follow, duplicate file extentions. The pages which are displayed carry over a varying amount of the main pages attributes. The files don't exist in our remote, so we've ruled out it being a product of human error.

Example:

http://www.callcentermiami.com/miami-virtual-receptionists.php/

http://www.callcentermiami.com/miami-virtual-receptionists.php/miami-virtual-receptionists.php/

http://www.callcentermiami.com/miami-virtual-receptionists.php/miami-virtual-receptionists.php/miami-virtual-receptionists.php/

All of these pages show up. I can literally duplicate the extension over and over again until the end of time and it won't go to a 404 page.

I know the pages don't exist and are not being indexed.

I'm also aware of the fact that it does not effect SEO.

However I would like to make the URL resolve to a clean URL which reverts back to the actual page such as this:

http://coding.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/

http://coding.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/introduction-to-url-rewriting/

http://coding.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/introduction-to-url-rewriting/introduction-to-url-rewriting/

I know that I need to do a rewrite, but would like some advice on the best way to go about it.

2
Contributors
1
Reply
18
Views
4 Years
Discussion Span
Last Post by Squidge
0

Evening tuyendoan. In your .htaccess file you will need something like :

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

This will remove the .php from the URL on the first level. You would need to test further for the deeper nested ones

Although i would suggest you look at why this anomoly is happening

Edited by Squidge

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.