M
M
MaksymPerehinka2017-02-23 14:13:22
Apache HTTP Server
MaksymPerehinka, 2017-02-23 14:13:22

The internal redirect does not work, where is the error in the rule?

There is a site on Wordpress: www.ff-group.org
There was a landing page on the site at www.ff-group.org/axis , but at some point the page began to issue a blank page. After a little debugging, it was determined that the URI blocks one of the Wordpress plugins/components that fires on the "init" action, and blocks any Wordpress page with such an alias.
As a temporary solution, the landing URI was changed to www.ff-group.org/axis2 , but now there is a task to make an internal redirect from www.ff-group.org/axis to www.ff-group.org/axis2.
For some reason, the redirect itself does not work, most likely the rule is simply written incorrectly, please help me fix it.
The .htaccess code is below, the desired rule is at the end of the file

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
  
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
</IfModule>

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^ff-group\.org$ [NC]
RewriteRule ^(.*)$ http://www.ff-group.org/$1 [R=301,L]

# Internal redirect
RewriteRule ^/axis$  /axis2 [L]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Volevach, 2017-02-27
@MaksymPerehinka

Alternatively, instead of htaccess, you can try add_rewrite_rule https://codex.wordpress.org/Rewrite_API/add_rewrit...
// example

add_action('init', 'do_rewrite');
function do_rewrite(){
  add_rewrite_rule( 'test', 'index.php?p=17', 'top' );
        flush_rewrite_rules();
}

A
Anton Zolotarev, 2017-02-23
@antonzol

Can RewriteCond be added before RewriteRule ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question