Home Apache mod_rewrite clashing with wordpress rule
Reply: 1

Apache mod_rewrite clashing with wordpress rule

Sam Ducker
1#
Sam Ducker Published in 2017-11-13 01:18:56Z

I have a page outside of the Wordpress installing but located in the root directory at v1.html

I've tried a few different mod_rewrite rules but they all seem to clash with the WordPress .htaccess rules. How can I keep my wordpress installation in tact but also have /v1.html renamed to /v1 without 404ing

    # 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 
jaswrks
2#
jaswrks Reply to 2017-11-14 22:13:28Z

Add your rule before the WordPress block and use the [L] to stop on your rule when it matches. This way it doesn't trickle into the WordPress rules.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^v1/?$ /v1.html [L]
</IfModule>

# 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
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.353734 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO