Apache .htaccess多个参数的重写规则
我找到了一些有用的链接,但我不明白为什么它不起作用。 当前url:Apache .htaccess多个参数的重写规则,apache,mod-rewrite,url-rewriting,Apache,Mod Rewrite,Url Rewriting,我找到了一些有用的链接,但我不明白为什么它不起作用。 当前url: http://localhost/noyk/clients/clients.php?name=StackOverflow&category=technology 我希望它的最终url是: http://localhost/noyk/clients/StackOverflow/technology 我已经找到了话题,我也试着去适应 Options +FollowSymLinks -MultiViews Rewrite
http://localhost/noyk/clients/clients.php?name=StackOverflow&category=technology
我希望它的最终url是:
http://localhost/noyk/clients/StackOverflow/technology
我已经找到了话题,我也试着去适应
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?name=$1&category=$2 [L,QSA]
RewriteRule ^([^/]+)/?$ index.php?name=$1 [L,QSA]
如果你们告诉我这应该行得通,那就不行了
当我输入urlhttp://localhost/noyk/clients/StackOverflow
我收到默认XAMPP页面错误:
The requested URL /noyk/clients/StackOverFlow was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
我猜你的.htaccess文件在你的网站根目录中?如果是,请移动到/noyk/clients/或按如下方式编辑: Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^noyk/clients/([^/]+)/([^/]+)/?$ index.php?name=$1&category=$2 [L,QSA] RewriteRule ^noyk/clients/([^/]+)/?$ index.php?name=$1 [L,QSA] 选项+以下符号链接-多视图 重新启动发动机 重写基/ 重写cond%{REQUEST_FILENAME}-F 重写cond%{REQUEST_FILENAME}-D 重写规则^noyk/clients/([^/]+)/([^/]+)/?$index.php?名称=$1,类别=$2[L,QSA] 重写规则^noyk/clients/([^/]+)/?$index.php?name=$1[L,QSA]
您是否在主配置文件中启用了mod_rewrite(并重新启动了apache?)。htaccess在哪里?