我的网址在下面。
http://192.168.43.173/My/tree/admin/city/city.php
我正尝试像下面这样重写它。
http://192.168.43.173/My/tree/admin/cities
我通过创建.htaccess文件在php目录中编写了以下代码
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule !.*\city/city.php$ %{REQUEST_FILENAME}cities [L]
以上均无效。我有想念吗?
答案 0 :(得分:0)
这将获取以city/city.php
结尾的URL,并将301重定向到cities
:
RewriteCond %{REQUEST_URI} .*/city/city.php
RewriteRule (.*)/city/city.php$ $1/cities [R=301, L]