I'm using the below htaccess rewrite rules to redirect old url files to the new ones.
The first RewriteRule redirects to new url file if the file path requested is fares/
or airfares/
or anyword-fares/
etc.
The second RewriteRule redirects to new URL file only if the url path requested is flights/
.
My 1st question is, did I write them correctly or leave anything out?
2nd question is, can I combine the two RewriteRules into one or use a rewrite condition to combine them into one?
I'm asking because I will be adding more that will redirect to the new url file of airfares-flights/
# For security reasons, Option followsymlinks cannot be overridden.
#Options +FollowSymLinks
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteRule ^.*fares/(.*)$ /airfares-flights/$1 [R=301,NC,L]
RewriteRule ^flights/(.*)$ /airfares-flights/$1 [R=301,NC,L]
Use this .htaccess:
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteRule ^(?:.*fares|flights)/(.*)$ /airfares-flights/$1 [R=301,NC,L]
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.