如果有人回答,我很抱歉,但我找不到任何对我有用的东西。这是一个廉价的godaddy共享服务器,基于PHP。
我尝试了一些RewriteRules但无济于事。
基本上,如果您链接到以下内容:
www.example.com/items/apple
它会保留在网址中,而是转到:
www.example.com/items
在项目页面中,我可以获得/ apple部分并按照我的意愿去做。通过像?dir = apple这样的参数或者像/ apple一样传入它。我现在的问题是重定向。我的.htaccess文件看起来像这样
RewriteEngine On
Options -Multiviews
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^item/([^/]+) /item?dir=$1 [NC]
答案 0 :(得分:0)
尝试添加其他条件和/或切换订单:
RewriteEngine On
Options -Multiviews
RewriteRule ^item/([^/]+) /item?dir=$1 [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.php -f
RewriteRule ^([^\.]+)$ $1.php [NC,L]