繁体   English   中英

使用htaccess php重写URL

[英]Rewrite URL using htaccess php

我想在我的项目中重写网址。

例如:

http://www.example.com/dashboard/test/http://dashboard.example.com/index.php

我也想这样做:

http://www.example.com/dashboard/test2/http://dashboard.example.com/index.php

谁能告诉我重写网址的想法?

首先,您在根目录中创建一个.htaccess文件。 比,只需将重定向命令放入其中。 此处说明了如何编写.htaccess以及如何创建重写规则: http : //net.tutsplus.com/tutorials/other/the-ultimate-guide-to-htaccess-files/

您将需要以下内容:

RewriteRule ^(.*)$ http://dashboard.example.com/$1 [L,QSA]

尝试这个

 Options +FollowSymLinks
RewriteEngine On
RewriteRule ^test.*$  http://dashboard.example.com/index.php [R=301,L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM