• Hello everyone!

    QUESTION BACKGROUND:
    I’m trying to get wordpress working in a subfolder on a website. I want to thoroughly test it before it goes live. I don’t want to interfere with the currently running website.

    ACTIONS TAKEN:
    I’ve created a new folder off root called wordpress, and thrown my wordpress files in here. I have logged into the General settings and changed the WordPress address (URL) and site address to http://www.mydomain.com/wordpress.

    Now when I go to preview, say the faq page, I see the url looks correct i.e. http://www.mydomain.com/wordpress/faq however it comes up with a 404.

    Now after a quick bit of reading – i get the impression i can modify the .htaccess file and use mod_rewrite to funnel all requests to wherever i want.

    I created a file called test.php which is a copy of index.php from the wordpress directory. (I called it test.php so it won’t interfere with the current live sites index.php).

    QUESTION:
    My thoughts on how to solve the situation is to use mod_rewrite to funnel all requests going to the /wordpress directory back to the test.php file.

    Does that sound about right?

    If so how would I modify my mod_rewrite to do this? I only want requests going to http://www.mydomain.com/wordpress/xxxxx to be picked up and re-written.

    My attempt so far. Do I need to add a condition of the wordpress folder somewhere?

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^test\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /test.php [L]
    </IfModule>

    Many thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You should not be using another file to try to recreate what WordPress does. The various PHP file include and require statements will fail all over the place, rendering the site useless.

    Instead, you need to remove any WordPress information from the .htaccess in the root of your website and then create a brand new .htaccess file in your wordpress subdirectory (if file permissions are set up correctly and you can access your WordPress admin area, you can do this by simply visiting the Permalinks page under the Settings menu – the .htaccess folder is recreated each time you visit that page).

    If it still doesn’t work, check the .htaccess file in your wordpress subdirectory and make sure that the RewriteBase is set to /wordpress/ instead of just /.

    Thread Starter sebastianpatten

    (@sebastianpatten)

    Epic – this fixed it.

    Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WordPress in a subfolder – mod_rewrite?’ is closed to new replies.