开发者

Do I need to do 301 redirect when changing file extensions

Currently:

www.mysite.com/index.php displays as www.mysite.com/index开发者_开发百科

I've redone my site and saved all of the files as .html files. So now:

www.mysite.com/index.html displays as www.mysite.com/index

Basically, all of the file names have stayed the same but the extension has changed from .php to .html. Before uploading the new files to the live server, should I be doing a 301 redirect of ALL the old .php URL's to the new .html URL's?

Keep in mind I have used .htaccess to not require users to enter the extension.


If you are already rewriting the URL's so you don't require the .php extension for any users then you only need to change your .htaccess so that they're now rewritten to the correct .html extension. There's no need to inform your end users with a 301 code if nothing changes from their perspective.

But if you do have some users using the extension now, you will need to use a 301 redirect to inform them that the URL has changed. It is advisable to redirect .php filenames to the no-extension version so that going forward, it becomes a non-issue and all your users use the non-extension versions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜