doubi9999 2014-11-12 13:17
浏览 117

重定向.html和.php链接到没有扩展名

I have a website, that i wrote by hand, no CMS, just for learning purposes. A while ago I rewrote my website using more of php and renamed the .html files to .php.

Ages ago I edited the .htaccess added some code that i got online. And what it did was, it doesn't use a tutorials/article.html or tutorials/article.phpbut no extensions at all: tutorials/article

I found that allot of websites that linked to my articles are still using the .html extension.

My question is how do I redirect all the links going to .php and .html to no extensions at all?

Also: I have social haring buttons on my website, does the redirect to no extensions at all, mean that all the +1, likes, tweets and linkedin are no more?

  • 写回答

2条回答 默认 最新

  • douzhe3516 2014-11-12 13:21
    关注

    Add the following to your htaccess. It will remove the .html

    RewriteRule ^([^\.]+)$ $1.html [NC,L] 
    

    Source: http://alexcican.com/post/how-to-remove-php-html-htm-extensions-with-htaccess/

    评论

报告相同问题?