Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/228.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
在php中使用.htaccess从一个url重定向到另一个url_Php_.htaccess_Redirect - Fatal编程技术网

在php中使用.htaccess从一个url重定向到另一个url

在php中使用.htaccess从一个url重定向到另一个url,php,.htaccess,redirect,Php,.htaccess,Redirect,如果我的url是 http://localhost/1/Qzz/images/ 然后我必须转到这个 http://localhost/1/Qzz/或http://localhost/1/Qzz/index.php 如何在.htaccess文件中编写所需代码。我试过这样做 RewriteEngine on RewriteCond %^http://localhost/1/Qzz/images$ RewriteRule ^(.*)$ http://localhost/1/Qzz/index.php/

如果我的url是

http://localhost/1/Qzz/images/

然后我必须转到这个

http://localhost/1/Qzz/
http://localhost/1/Qzz/index.php

如何在.htaccess文件中编写所需代码。我试过这样做

RewriteEngine on
RewriteCond %^http://localhost/1/Qzz/images$
RewriteRule ^(.*)$ http://localhost/1/Qzz/index.php/$1 [R,L]
这是从谷歌获得的,但没有运气。我收到内部服务器错误。尝试下面的代码时会出现相同的错误

Redirect http://localhost/1/Qzz/images  http://localhost/1/Qzz/index.php
我需要你的帮助……

正如Prava MindfireSolutions所说,如果使用

Redirect 301 http://localhost/1/Qzz/images/ http://localhost/1/Qzz/index.php 
那就行了


有关更多信息:

请尝试使用此
重定向301/1/Qzz/images/http://localhost/1/Qzz/index.php
@Prava MindfireSolutions,尝试并获得了它。。谢谢,我不知道发生了什么事。我以前已经尝试过这段代码,但没有成功,现在再次尝试,就像你说的那样,然后成功了。可能是打字错误或其他。不管你的评论对我有什么帮助,非常感谢……)很好,它起了作用:)