因为我所有的文件都是PHP我已删除PHP扩展与此.htacess文件:删除目录名
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
所以我有这个网址:
http://example.com/live/kanal/some-title-1
http://example.com/live/kanal/some-title-2
http://example.com/live/kanal/some-title-13
http://example.com/live/kanal/some-title-45
http://example.com/live/kanal/2some-title-333
等等
我想隐藏KANAL /从以下网址,获得网址是这样的:
http://example.com/live/some-title-1
http://example.com/live/some-title-2
http://example.com/live/some-title-13
http://example.com/live/some-title-45
http://example.com/live/2some-title-333
如何使用mod_rewrite实现这一目标?
我使用在线生成器来完成重写规则,但是没有人可以从URL中删除一段文本。我也在这个论坛上搜索过,并且发现了一些关于mod重写目录的文章,但是当我粘贴我的.htacess代码时遇到了问题。
在根中我有一个.htacess。在这个文件中,我只有404重定向。 在http://example.com/live/我有另一个,这是从帖子开始.htacess。 – Aleksandar