WordPress.org

Forums

.htaccess with more than one command (3 posts)

  1. gatorgse
    Member
    Posted 8 years ago #

    I just upgraded to an SSL for my website, and I need to write a 301 redirect for the new location. This is what I have now:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    UPDATE wp_posts SET post_content = replace(post_content, 'http://www.yourcruiseyourway.com/wordpress', 'http://www.yourcruiseyourway.com');
    Redirect 301 /wordpress/ http://www.yourcruiseyourway.com/
    # END WordPress

    and this is what I need to add:

    RewriteEngine on
    rewritecond %{http_host} ^yourcruiseyourway.com [nc]
    rewriterule ^(.*)$ http://www.yourcruiseyourway.com/$1 [r=301,nc]

    So where do I insert the second part into the first part to make it work corrcetly and show my site as https:?

    Thanks

  2. gatorgse
    Member
    Posted 8 years ago #

    anyone on that might be able to comment?

    Thanks

  3. whooami
    Member
    Posted 8 years ago #

    1. youve pasted stuff that does not belong in an .htaccess, specifically this:


    UPDATE wp_posts SET post_content = replace(post_content, 'http://www.yourcruiseyourway.com/wordpress', 'http://www.yourcruiseyourway.com');

    I dont know where you got that from but thats not going to do anything.

    2. If you are requiring SSL for all access to the site, you dont need to use mod_rewrite, all you need to do is use the SSL url in your URL option thats located in the backend..

    If you are intent on rewriting http to https then those rules need to go above your WP rules. Place them outside of the "Begin WordPress" stuff also.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags