Support » Installing WordPress » htaccess Rewrite

  • Hi guys,
    I have a website, in this path public_html/TEST
    and the .htaccess in this path public_html/.htaccess
    This is the htaccess:

    RewriteOptions inherit
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /TEST/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /TEST/index.php [L]
    </IfModule>
    
    # END WordPress

    So, the url of my website is
    http://www.mywebsite.com/TEST

    The website is live and i need to set up these condition:

    1) I need the url is http://www.mywebsite.com (I need to keep the files in the folder TEST )
    2) I have to redirect http://www.mywebsite.com/TEST to http://www.mywebsite.com
    So i guess for the point 2, i have just to do a redirect 301.

    Could anyone help me with the point 1 please?
    Many thanks
    Simone

Viewing 3 replies - 1 through 3 (of 3 total)
  • Here is the page to read:
    http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

    I strongly recommend that you consider an alternative approach, described in the “Using a pre-existing subdirectory install” section of the same page. I’ve been using it for about 6 years now, and find it much more flexible, less error-prone, etc.

    Thread Starter Symon83

    (@symon83)

    Hi thanks for your answer.

    I definitely changed my mind.

    Now i made a copy of the website and the db in the main root public_html.

    So i have 2 copy of the website, both working. How can i redirect properly with 301 wordpress from

    http://www.mywebsite.com/TEST
    to
    http://www.mywebsite.com

    I used a simple .htaccess in the folder /TEST
    redirect 301 / http://www.mywebsite.com

    but it redirect the website wrong with this result:

    typing http://www.mywebsite.com/TEST
    i get
    http://www.mywebsite.comTEST

    Is there any better option to redirect? please

    RewriteOptions inherit
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /TEST/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /TEST/index.php [L]
    </IfModule>
    
    # END WordPress

    this is the original htaccess in the folder /TEST
    thanks

    As I said, I hate playing around with .htaccess except to set php options on web servers that don’t allow php.ini changes.

    The aforementioned “Using a pre-existing subdirectory install” section explains a much cleaner way to handle things: have just one copy of WordPress, installed in a folder, and have all the links look like you are “running from the root”.

    There are plugins that change all your links for you, avoiding the need to do any redirections in .htaccess.

    Again, just my experience and opinion.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘htaccess Rewrite’ is closed to new replies.