我知道这个问题之前已被问过很多次但我需要帮助。我花了好几个小时在这上面,我无法弄清楚以下htaccess
代码中的错误。
Options +FollowSymLinks
RewriteEngine on
RewriteRule services/z/(.*)/ services.php?z=$1
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://rcunlocks.com/$1 [R,L]
我正在尝试重新编写网址
https://rcunlocks.com/services.php?z=spus3
到
https://rcunlocks.com/services/spus3
如果我的htaccess文件出现问题,请告诉我。
非常感谢您的帮助。谢谢。
答案 0 :(得分:0)
试试这个
Options +FollowSymlinks
RewriteEngine on
# check that the request url is neither a file nor a directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^services/(.*) services.php?z=$1 [NC]
答案 1 :(得分:0)
我看到2个问题:
/services.php?z=spus3
公开给浏览器MultiViews
可以覆盖此重写规则。解决这两个问题的方法是这样的:
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=302,L]
RewriteRule ^services/z/([^/]+)/?$ services.php?z=$1 [L,QSA,NC]