例如我有像http://localhost/Experiments/login/login.php这样的网址
我已经隐藏了将文件放在.htaccess文件下面的代码的范围
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteCond %{REQUEST_FILENAME}\.png -f
RewriteRule ^(.*)$ $1.png
RewriteCond %{REQUEST_FILENAME}\.css -f
RewriteRule ^(.*)$ $1.css
RewriteCond %{REQUEST_FILENAME}\.js -f
RewriteRule ^(.*)$ $1.js
RewriteCond %{REQUEST_FILENAME}\.jpg -f
RewriteRule ^(.*)$ $1.jpg
RewriteCond %{REQUEST_FILENAME}\.ico -f
RewriteRule ^(.*)$ $1.ico
我如何才能将上述URL设置为http:// localhost / login,即使我尝试了与stackoverflow中相同问题相关的解决方案,但还是无法做到这一点
在以下RewriteEngine On
行插入此规则:
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/Experiments/login/$1.php -f
RewriteRule ^([\w-]+)/?$ Experiments/login/$1.php [L]
# remaining rules go below this
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句