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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.