dongyong8491 2014-02-26 16:21
浏览 148
已采纳

.htaccess中的隐藏文件扩展名

I have hidden my file extensions on my website URL and I am wondering if I need to change my links on the other pages.

For example, If I have 'www.example.com/packages', should I then change the links pointing to that page from href="packages.php" to href="packages" since the file extension is now just 'packages' instead of 'packages.php'.

Is this important to change or would it be better to leave it as-is? Which would be better for SEO?

  • 写回答

2条回答 默认 最新

  • doutongxuan1614 2014-02-26 16:33
    关注

    It is better to have links as href="packages" for SEO purpose.

    And for the URLs already indexed in search engines use this 301 rule:

    RewriteEngine On
    
    RewriteCond %{THE_REQUEST} \s/+(?:index)?(.*?)\.php[\s?] [NC]
    RewriteRule ^ /%1 [R=301,L,NE]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?