2011-06-09 118 views
0

我想重定向以下網址:使用mod_rewrite.htaccesshtaccess的重定向到另一個網址

我該怎麼辦

http://abc.com/colleges/first.php

http://abc.com/first.php

這個?

+0

搜索[.htaccess重定向](http://stackoverflow.com/search?q=.htaccess+redirect) – 2011-06-09 12:44:40

+0

請在投票前閱讀:http://meta.stackexchange.com/questions/39063關閉。 – Kev 2011-06-13 12:25:15

回答

0

嘗試在你的.htaccess驗證碼:

Options -MultiViews +FollowSymLinks 
RewriteEngine On 

RewriteRule ^[^/]+/(.*)$ /$1 [L] 
0

如果它只是first.php頁面,則:

RewriteEngine on 
RewriteBase/
RewriteRule ^colleges/first.php$ /first.php 

如果是需要重定向到根的/colleges文件夾中的每個頁面:

RewriteEngine on 
RewriteBase/
RewriteRule ^colleges/(.*)$ /$1