Answer the question
In order to leave comments, you need to log in
How to write different rules for different urls in .htaccess?
How to write for URLs with the following links:
domen.ru/blog/ domen.ru/board/
domen.ru/forum/
Rule
: instead of .htm, end the link without the .htm extension (example: domen.ru/blog/302513).
And for all other links, the rule for assigning links as a post name for WP is:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
The problem arose because of the old site archive on .htm and the new one on wp.
The entire old site is flooded from the archive, and it is necessary to keep the URLs of the old ones and combine them with those configured on WP.
They suggested this:
RewriteEngine On
RewriteBase /
RewriteRule ^blog/(.*)\.htm /blog/$1 [R,L] # converted to a link without htm and redirected to it
RewriteRule ^blog/(.*) - [L] # if opening from blog folder, then do nothing
RewriteRule ^board/(.*)\.htm /board/$1 [R,L]
RewriteRule ^board/(.*) - [L]
RewriteRule ^forum/(.*)\.htm /forum/$1 [R,L]
RewriteRule ^forum/(.*) - [L]
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
but wp urls are displayed normally, but an error is displayed from the archive in .htm and does not work
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question