0

I have a website built in .php but we have converted it to .html by using "mod rewrite". the mod rewrite code used in .htaccess is
"RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php"

Now the problem is my website shows up in both .php and .html.

for example: www.mydomain.com/index.html and also www.mydomain.com/index.php.

as per my knowledge its not good for seo purpose and also it may fall in duplicate content to search engines.

so i want to keep only .html [not .php] url live on search engines and for users.

how to do that?

4
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by diafol
0

Have you cleared your cache? If you have removed the .php file from your file manager/server then it should stop displaying once you've deleted temporary files.

If you haven't removed it from your file manager it may also show up if you haven't updated your internal web links. Also DNS may be taking it's time to update.

0

Hi Cleo123,

I think, I have not made myself clear. I have .php files which are written and the same files have been re-written using mod_rewrite through .htaccess. As I have mentioned in my first thread, when I am a rewriting my existing url, example.com/index.php to example.com/index.html.

Rewriting is doing its fantastic job, but the problem lies at when I go manually to example.com/index.php, that is also accessible.

With this rewriting, I might face some issues in terms of seo, as search engine robots may consider this as duplicated urls (which can be avoided through canonical system) but that does not help my visitors as they see two different urls with same information.

How can I not display the original .php file after rewriting it to .html...

Request to help.... thanks

0

I've never tried this, but it should be possible to redirect the .php with a 301 to the .html but you should be careful not to create an endless loop.

Another option would be to rename all your .php files to .html and add a handler in your htaccess to treat them as php files.

Edited by pritaeas: n/a

0

dear friend,

my website is built in php and i want to redirect it to html. i cannot change php to html because i have cart attached to it. So its not possible.

But thanks for your kind reply.

I've never tried this, but it should be possible to redirect the .php with a 301 to the .html but you should be careful not to create an endless loop.

Another option would be to rename all your .php files to .html and add a handler in your htaccess to treat them as php files.

0

I'm slightly confused here.

Is there any reason why you need .html instead of .php?
As Pritaeas states, you can change your .htaccess to accept php coding within .html files. So you can just rename .php files to .html.

Does the cart insist you use .php files?

The whole point of rewrites AFAIK is that you can apply certain 'new fancy zingy url patterns' that the server will read as 'the original long ugly urls'. The old urls should still work.

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.