Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一些页面将进入 404 页面,我必须将其中一些页面重定向到其他页面而不是 404。例如。我有页面,我需要将其从 www.site.com/somelink/link 重定向到 www.site.com/?q=somelink
我已经尝试过这种方式:Redirect 301 www.site.com/somelink/link http://www.site.com/?q=somelink在 htaccess 中,但这并没有给我结果。我错在哪里?
Redirect 301 www.site.com/somelink/link http://www.site.com/?q=somelink
您需要使用mod_rewrite假设您正在使用apache:
mod_rewrite
apache
Options +FollowSymLinks RewriteEngine on RewriteRule (/somelink/link) http://www.site.com/?q=$1 [R=301,L]
由于我自己的误解,我不得不使用Redirect 301 /somelink/link http://www.site.com/?q=somelink
Redirect 301 /somelink/link http://www.site.com/?q=somelink