1
请帮我解决这种情况。正确.htaccess
我有一个共享主机,我想调整我的.htaccess
文件的好方法。 我有以下网页:
index.html
news.html
- 页面,如
post-01-11-2015.html
现在我想:
- 删除所有
.html
所有网址末尾 - 如果当前页面是
index.html
,我想看看example.com
,不example.com/index.html
- ,当我在
news.html
页打开post-01-11-2015.html
,我想看看在浏览器的URL像example.com/posts/2015/11/01
。我想输入example.com/posts/2015/11/01
我想看页。 - 任何你建议我,是非常好的。
如果您需要任何信息,请告诉我。
现在有这个模块代码,但我得到错误cycle redirection
。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^(.*) http://%1/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://www.example.com [R=301,L]
RewriteRule ^post-(\d+)-(\d+)-(\d+)\.html$ /posts/$1/$2/$3 [R=301,L,NC]
RewriteRule post-(\d+)-(\d+)-(\d+)\.html$ posts/$1/$2/$3 [R=301,L,NC]
RewriteRule (.+)\.html$ /$1 [R=301,L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L,QSA]
</IfModule>
非常感谢!希望你能帮助我最好的方式!
是......不工作 – platinumfives