2012-04-03 28 views
0

我想所有的舊網址重定向到我的新網址只是想使用htaccess將我的網站的所有已知地址重定向到特定文件?

我這背後最主要的原因是管理員將進入這樣一個 http://mysite.com/oil--gas/corrosion-management-summit-in-oil-and-gas!e29在我的網站的地址,我想這個不明地址,該地址重定向到具體的文件,並獲得網址,並從我的數據庫中搜索並重定向到特定的地址。

舊= http://mysite.com/oil--gas/corrosion-management-summit-in-oil-and-gas!e29

如果用戶這樣輸入地址,我只是想重定向這個地址像redirect.php特定的文件,並得到查詢字符串,從它使任何人可以幫助我這個問題。

+1

你搜索了 「漂亮的URL」 或 「URL重寫」 呢?有很多這方面的信息。 – deceze 2012-04-03 05:03:17

回答

0

試試這個..

# Redirect old file path to new file path 
Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html 
0
Options +FollowSymLinks 
IndexIgnore */* 
# Turn on the RewriteEngine 
RewriteEngine On 
# Rules 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . index.php