.htaccess从root重定向到html保存所有链接

时间:2015-07-02 21:02:44

标签: php .htaccess

我有一个localhost/news_back网址(我的PHP脚本在这里) 我有一个localhost/news_back/client/admin.html 我需要重定向每个用户,来到我的主机admin.html。 这意味着用户必须在他的地址栏中看到:

http://localhost/news_back/client/admin.html

这也意味着我的html中的所有脚本和img源都必须正常工作。 我的所有POST和GET请求都必须保存他们的网址。

我尝试的所有内容都会改变路径或导致错误。

2 个答案:

答案 0 :(得分:1)

试试这个。可以帮助你......

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/$
RewriteRule (.*) http://localhost/news_back/client/admin.html [R=301,L]

答案 1 :(得分:0)

好的,伙计们,感谢您的建议,但我的托管服务提供商提供了解决方案,这有帮助! RewriteEngine on RewriteCond %{HTTP_HOST} ^[mydomain].com$ [OR] RewriteCond %{HTTP_HOST} ^www.[mydomain].com$ RewriteRule ^$ http://aranews.blogjist.com/client/admin.html [R=301,L]

相关问题