wordpress htaccess doesnt change url, just goes to 404

The line of code:

RewriteRule ^/test/(.*)/?$ http://test.com/test/index.php?route=$1 [L,QSA]

has no effect in the htaccess file that I am using:

Read More
    # 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]
RewriteRule ^/test/(.*)/?$ http://test.com/test/index.php?route=$1 [L,QSA]

</IfModule>

# END WordPress

When I visit my domain.com/test/123, WordPress redirects be to a 404 page not the new link.
I have tried moving the items in the htaccess file around in case they are being overwritten, but not luck. any ideas?

Related posts

Leave a Reply

1 comment

    • Problem 1: RewriteRule doesn’t match leading slash.

    • Problem 2: Wrong order of Rewrite Rules.

    Here is the fixed version:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^test/(.*)/?$ http://test.com/test/index.php?route=$1 [L,QSA,NC]
    
    RewriteRule ^index.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress