简体   繁体   中英

htaccess wordpress redirect directory

I already have some url redirect rule in my root htaccess so after following the step to give wordpress its own directory everything work well apart that my old url redirection/rewrite don't work any more.

old htaccess

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule   dailylife/(.*)\.html dailylife.php?d=$1

new one with wordpress directory

RewriteBase /news/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /news/index.php [L]
RewriteRule   dailylife/(.*)\.html dailylife.php?d=$1

any help most welcome

You need to have your old rules before wordpress' routing rules:

RewriteBase /news/

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteRule dailylife/(.*)\.html /dailylife.php?d=$1 [L]

RewriteBase /news/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /news/index.php [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.

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