Redirect to a wordpress page using Rewrite rules (1 post)

  1. freesteel
    Posted 7 years ago #

    I have wordpress in a sub directory wpblog, and you would get it by typing "http://mysite.org/wpblog" into your browser.

    I want to redirect from a page "http://mysite.org/test.html" to "http://mysite.org/wpblog/testtopic", where testtopic is a page in the blog.

    I have permalinks enabled and allowed wordpress to write a .htaccess file into wpblog.

    To do this I tried this:

    I added a .htaccess file to the root directory (where test.html would be located) of this form:

    RewriteEngine on
    RewriteRule ^test\.html$ /wpblog/testtopic

    A request of the form "http://mysite.org/test.html" now goes to wpblog, but gives a '404 not found' - page, themed by my wordpress theme setting.

    I can't work out exactly why this happens. To me it looks as if the wordpress generated .htaccess redirects EVERY url with the base wpblog to /wpblog/index.php, and then wordpress internally resolves which pages it should bring up. But why can't it resolve /wpblog/testtopic this way? (I can type "http://mysite.org/wpblog/testtopic" directly into the browser I get the correct page.) Or does wordpress try to make sense of "test.html" which in fact does not exist in wpblog.

    I am mystified, and yes, I have searched the support forums.
    (To be honest I don't have much hope to get this answered, given that there are loads of unanswered topics when you search for 'rewrite permalinks').


Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.