I
I
Ilya2017-01-23 13:18:11
PHP
Ilya, 2017-01-23 13:18:11

What is the correct way to write this in .htaccess?

There are 2 different directories with different .htaccess files in each:

.htaccess #1:

# BEGIN [SEO_REDIRECTION]
 ErrorDocument 404 /index.php?error=404 
# END [SEO_REDIRECTION]

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


.htaccess #2:
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d


RewriteCond $1 !^(redirect\.php)
RewriteRule ^(.*)$ redirect.php?l=$1 [L]


There was a need to combine them into one, but if I just "glue" the contents of .htaccess, then nothing works. I tried to remove various lines, but nothing came out anyway. I apologize for the crooked code, I'm a noob.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2017-01-23
@smolikk

The problem was solved by changing the type of links in Wordpress.
After that, the engine itself changed its .htaccess:

# BEGIN [SEO_REDIRECTION]
 ErrorDocument 404 /index.php?error=404 
# END [SEO_REDIRECTION]

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d


RewriteCond $1 !^(redirect\.php)
RewriteRule ^(.*)$ redirect.php?l=$1 

# BEGIN WordPress

# END WordPress

And everything began to work like clockwork.

A
Alexander Aksentiev, 2017-08-03
@Sanasol

https://jsconsole.com/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question