我想在我的项目中重写url。
例如: http://www.example.com/dashboard/test/
到http://dashboard.example.com/index.php
我还想为:
http://www.example.com/dashboard/test2/
到http://dashboard.example.com/index.php
谁能告诉我重写url的想法?
首先在根目录下创建一个.htaccess文件。然后,把重定向命令放进去。如何编写。htaccess和如何创建重写规则在这里解释:http://net.tutsplus.com/tutorials/other/the-ultimate-guide-to-htaccess-files/
你需要这样写:
RewriteRule ^(.*)$ http://dashboard.example.com/$1 [L,QSA]
try this
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^test.*$ http://dashboard.example.com/index.php [R=301,L]