Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/281.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
如何删除“;index.php?“;来自HTACCESS_Php_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

如何删除“;index.php?“;来自HTACCESS

如何删除“;index.php?“;来自HTACCESS,php,apache,.htaccess,mod-rewrite,Php,Apache,.htaccess,Mod Rewrite,我有这样的url: www.site.com/index.php?/genro/aventura/av/ 但我希望这是我的新网址: site.com/genro/aventura/av/ 我使用了以下代码: <IfModule mod_rewrite.c>RewriteEngine On RewriteCond %{HTTP_HOST} !^www.site.com/$ [NC] RewriteRule ^index.php\?/(.*)$ site.com/$1 [R=301,L]

我有这样的url:

www.site.com/index.php?/genro/aventura/av/

但我希望这是我的新网址:

site.com/genro/aventura/av/

我使用了以下代码:

<IfModule mod_rewrite.c>RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.site.com/$ [NC]
RewriteRule ^index.php\?/(.*)$ site.com/$1 [R=301,L]
</IfModule>

感谢阅读。

用以下内容替换您的规则:

DirectoryIndex index.php
RewriteEngine On

RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [L,R=302,NC,NE]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(index\.php|public|css|js|i|feed|portadas|robots\.txt|BingSiteAuth\.xml|plugins|i|mp3|favicon\.ico|pluginslist\.xml|google3436eb8eea8b8d6e\.html)
RewriteRule ^(.*)$ /index.php?/$1 [L]

主机:
名称不包含尾随斜杠。查询字符串不能作为重写规则路径使用,只能作为重写规则路径使用。顺便说一句,您的规则只重定向到预期的新URL方案。除非您还处理随后传入的规范化路径,否则index.php处理程序脚本将不会被调用但是仍然没有解决为什么你在
RewriteCond%{THE_REQUEST}www.page.com/index\.php
中使用了我的建议?你也使用了你的建议,并给出了相同的结果,尝试删除www.and index.php?因为当我试图删除www.I只是转到index.php?时,我同时删除了(www和index.php?)。在你的问题中粘贴你最新的&full.htaccess。现在你可以看到上面的代码了,我发布了这个部分
DirectoryIndex index.php
RewriteEngine On

RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^(.*?)index\.php$ /$1 [L,R=302,NC,NE]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(index\.php|public|css|js|i|feed|portadas|robots\.txt|BingSiteAuth\.xml|plugins|i|mp3|favicon\.ico|pluginslist\.xml|google3436eb8eea8b8d6e\.html)
RewriteRule ^(.*)$ /index.php?/$1 [L]