WordPress.org

Ready to get started?Download WordPress

Forums

.htaccess mod_rewrite blues (1 post)

  1. drhyatt
    Member
    Posted 1 year ago #

    Having a problem with wordpress and .htaccess mod_rewrite rules.

    What I'm trying to do is set up a redirect so that:

    http://mysite.com/people/person-name

    Redirects to a templated page in my wordpress themes folder, with a querystring attached:

    http://mysite.com/wp-content/themes/mytheme/people.php?name=person-name

    My rewrite rule looks like this

    RewriteRule ^people/(.*)/$ wp-content/themes/mytheme/people.php?name=$1 [R]

    The redirect itself is working pretty flawlessly. If I enter
    http://mysite.com/people/person-name into the URL bar, it does in fact load the page at http://mysite.com/wp-content/themes/mytheme/people.php?name=person-name.

    HOWEVER anything and everything on the page that has to do with wordpress is broken.

    It starts off by returning this error, then quits:

    Fatal error: Call to undefined function get_header() in /nfs/c02/h10/mnt/30359/domains/website.mysite.com/html/wp-content/themes/mytheme/people.php on line 13

    If I remove the get_header() call from the page, the page loads, but the template style sheet fails to load in and the page looks like... well, how you'd expect a page with a missing stylesheet to look.

    When I access the page by entering the full url (http://mysite.com/wp-content/themes/mytheme/people.php?name=person-name), the get_header() call inserts the header.php file into the page successfully and the stylesheet loads.

    From what I can tell, it looks to me like wordpress is looking for files in a subdirectory of the "fake" URL the address bar instead of relative to where the page actually resides.

    Anybody know how to fix or work around this?

Topic Closed

This topic has been closed to new replies.

About this Topic