简体   繁体   中英

Many 404 errors with email address at the end

I'm getting a lot of 404 error notices (about 200 of them) from my website for URLs that have my email address at the end. For example: http://mysite.com/blog/myname@mysite.com

My first thought is to use .htaccess to redirect the URLs to the real URL without the email address at the end but I don't know how to do that. Any suggestions would be greatly appreciated.

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule RewriteRule ^(.*?/?)(?=[^/]*$)[^@]*@ /$1 [L,R=302,NE]

Once you verify it is working fine, replace R=302 to R=301 . Avoid using R=301 (Permanent Redirect) while testing your mod_rewrite rules.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM