Forums

Using a RewriteRule to display a WordPress page (1 post)

  1. danvdk
    Member
    Posted 3 years ago #

    Hi,

    Let's say my blog is foo.com and I have WordPress installed in foo.com/wp. I'd like to be able to go to http://foo.com/x/ and have it show me http://foo.com/wp/index.php?p=296 while keeping "http://foo.com/x/" in the location bar. To do this, I created a .htaccess file in the root directory for foo.com containing this:

    RewriteEngine on
    RewriteRule ^/?x/?$ /wp/index.php?p=296

    When I go to foo.com/x/, I get WordPress's "Not Found" page. However, if I change my .htaccess to this:

    RewriteEngine on
    RewriteRule ^/?x/?$ /wp/index.php?p=296 [R]

    then everything works great. The page I want displays, but since Apache sent out a redirect, the URL in the location bar has changed as well. Is there any way I can make this RewriteRule do what I want? Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic