在php中使用.htaccess从一个url重定向到另一个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/
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,尝试并获得了它。。谢谢,我不知道发生了什么事。我以前已经尝试过这段代码,但没有成功,现在再次尝试,就像你说的那样,然后成功了。可能是打字错误或其他。不管你的评论对我有什么帮助,非常感谢……)很好,它起了作用:)