WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] htaccess redirect problem

[Resolved] htaccess redirect problem

  • In my htaccess file, I did a server redirect to the WP directory, as below:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?example.com$
    RewriteCond %{REQUEST_URI} !^/subdirectory/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /subdirectory/$1
    RewriteCond %{HTTP_HOST} ^(www.)?example.com$
    RewriteRule ^(/)?$ subdirectory/index.html [L]

    That is suppose to prevent anyone from seeing the WP directory, but it still shows in the URL. I’m thinking I’m going to need to change something in WP somewhere to get rid of the WP directory showing:

    Note that the WP directory does not show when hitting the main site, only when you navigate away from the main site to a different page. This tells me the htaccess is working as it should, but when WP gets involved, it’s a different story.

    http://www.dwdallam.com

Viewing 1 replies (of 1 total)
  • OK I tried the WP index.php method once a gain and now it works.

    First, I cleaned out all of my root files that I didn’t need, including a few php files. Then I deleted my root htaccess file and let the server create another one.

    Then I used the index.php file by copying it to the root directory and making the changes as posted in many places, and I’ll post it here too:

    From this:
    require(‘./wp-blog-header.php’);
    to this:
    require(‘./your-word-press-subdirectory/wp-blog-header.php’);

    In the official directions it says to copy the WP htaccess file to your root, but in my case I didn’t need to.

    You also need to change in “Settings>General” the “site URL” to your domain name only, without any trailing slash:
    http://yourdomain.com

    Now all of my URL look like:
    mydomain/pagename

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] htaccess redirect problem’ is closed to new replies.