• My wordpress blog is installed at domain.com/blog and I have a page with subpages whose structure look like domain.com/blog/page and domain.com/blog/page/subpage.

    I want my visitors to be able to go to domain.com/subpage and see the content of domain.com/blog/page/subpage without being redirected to that URL externally, avoiding wordpress permalink rewrites.

    I tried using RewriteRule ^subpage$ /page/subpage [L] and the content is being served, but the url looks like domain.com/blog/page/subpage (I’d guess WordPress permalinks are getting to it.)

    .htaccess under /blog:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /blog/
    RewriteRule ^index\.php$ – [L]

    // tried inserting my code here.

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

    # END WordPress

    .htaccess under domain.com:

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

    RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.domain.com$

    Should I be focusing on wp_rewrite? non_wp_rewrite? Thanks!

  • The topic ‘Rewriting a URL outside of WordPress Root’ is closed to new replies.