Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache .htaccess重写不起作用_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Apache .htaccess重写不起作用

Apache .htaccess重写不起作用,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我需要在.htaccess中重写的帮助 我正在努力做到以下几点: 当用户键入http://www.example.com/csc/alabama/ 我需要从http://www.example.com/csc/index.php?state=alabama 我想应该是这个 Options +FollowSymLinks RewriteEngine On RewriteRule ^csc/([^/]*)$ /csc/index.php?state=$1 [L] 我一直收到一个404错误 另一方面

我需要在.htaccess中重写的帮助

我正在努力做到以下几点: 当用户键入
http://www.example.com/csc/alabama/
我需要从
http://www.example.com/csc/index.php?state=alabama

我想应该是这个

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^csc/([^/]*)$ /csc/index.php?state=$1 [L]
我一直收到一个404错误


另一方面,我希望能够使用一个通用子目录来实现这一点,这样csc就可以是abc或其他任何东西,但这不是优先级。

您忘记了模式中的尾随斜杠。您还应排除要重定向到的目标:

RewriteCond $1 !=index.php
RewriteRule ^csc/([^/]*)/$ /csc/index.php?state=$1 [L]