Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.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
.htaccess 始终存在htaccess问题_.htaccess - Fatal编程技术网

.htaccess 始终存在htaccess问题

.htaccess 始终存在htaccess问题,.htaccess,.htaccess,我正试图用我的htaccess解决一个问题 RewriteBase / RewriteRule ^(.+)/$ /$1 [R=301,L] RewriteRule ^profile/(.*)$ details.php?profile=$1 [L,NC,QSA] RewriteRule ^industry/(.*)$ category.php?industry=$1 [L,NC,QSA] RewriteCond %{REQUEST_FILENAME} !-f

我正试图用我的htaccess解决一个问题

   RewriteBase /
   RewriteRule ^(.+)/$ /$1 [R=301,L]
   RewriteRule ^profile/(.*)$ details.php?profile=$1 [L,NC,QSA]
   RewriteRule ^industry/(.*)$ category.php?industry=$1 [L,NC,QSA]

   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d 
   RewriteRule ^index.php$ /index.php [L,NC]
只要有个人资料或行业匹配,它就可以正常工作。。但现在我想实现的是,当上述规则不匹配时,它应该将用户重定向到主页(www.example.com)。发生的情况是,它将我重定向到index.php,但问题是它仍然显示在浏览器上(www.example.com/skfjsf/sfjsfk),我想将其更改为(www.example.com)

尝试:

RewriteRule ^index.php$ /index.php [r=301,nc]      

//instead of 

RewriteRule ^index.php$ /index.php [L,NC]

感谢您回答PolCPP,但不幸的是,当我在浏览器中键入类似的内容时,它重定向到index.php,但在浏览器窗口中,它仍然显示我想显示类似的内容,或者是的,我得到了它。。。重写规则/php[R=301,L]谢谢你啊,该死的打字错误。没问题:)htaccess很烦人