由网友(青森。)分享简介:你有什么想法如何从一个静态页面的URL删除的.html。另外,我需要重定向任何URL以.html到一个没有(即www.example.com/page.html到www.example.com/page~~V)。Do you have any idea how to remove .html from the URL...
你有什么想法如何从一个静态页面的URL删除的.html。另外,我需要重定向任何URL以.html到一个没有(即www.example.com/page.html到www.example.com/page~~V)。
Do you have any idea how to remove .html from the URL of a static page. Also, I need to redirect any url with .html to the one without (ie. www.example.com/page.html to www.example.com/page).
推荐答案
感谢您的答复。我已经解决了我的问题。假设我有以下的 http://www.yoursite.com/html ,下面的的.htaccess 规则。
Thanks for your replies. I have already solved my problem. Suppose I have my pages under http://www.yoursite.com/html, the following .htaccess rules apply.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /html/(.*).html HTTP/
RewriteRule .* http://localhost/html/%1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /html/(.*) HTTP/
RewriteRule .* %1.html [L]
</IfModule>
相关推荐
最新文章