简体   繁体   中英

Broken Links .htaccess issue

I checked my WordPress theme on broken link checker website and its giving me a list of broken URLs.

See:

http://www.esmedicare.com/locations.html ( parent page: http://www.esmedicare.com/ )
http://www.esmedicare.com/laser-treatments/locations.html ( parent page: http://www.esmedicare.com/laser-treatments/ )

The links with /location.html goes to 404 page and I want to redirect these pages to their parents page. ie Just remove the /location.html from URL and to redirect these to their parent URL mentioned in the bracker.

I added code:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)/locations.html$ /$1/ [L,R=301]

to my .htaccess file, now some /location.html pages are redirecting to their parent page but still not all of them.

Please solve my issue...I just want to remove the /location.html from last in the URL.

如果需要包含Web根目录( / ),则需要使斜杠为可选:

RewriteRule ^(.*?)/?locations.html$ /$1/ [L,R=301]

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