只想使用htaccess将我网站的所有已知地址重定向到特定文件


Just want to redirect all know address of my site to specific file using htaccess?

我想将所有旧url重定向到我的新url

我的主要原因是管理员会输入这样的地址http://mysite.com/oil--gas/corrosion-management-summit-in-oil-and-gas!e29在我的网站上,我想得到这个未知的地址,并将这个地址重定向到特定的文件,得到url,从我的数据库中搜索它,并将它重定向到特定地址。

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

如果用户像这样输入地址,我只想将这个地址重定向到像redirect.php这样的特定文件,并从中获取查询字符串,这样任何人都可以帮助我解决这个问题。

试试这个。。

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