WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Updating HTACCESS for Multiple index Rredirects (5 posts)

  1. bangjoman73
    Member
    Posted 9 months ago #

    Looking to find the coding so I can also have index.html and index.asp 301 redirect just for the index of the root domain.

    Permalinks are set to /%category%/%postname%/

    Not looking to change the permalinks.

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

  2. redirect /index.html http://www.your-link-here.com
    redirect /index.asp http://www.your-link-here.com

    *This is outside of the <IfModule mod_rewrite.c> block.

  3. bangjoman73
    Member
    Posted 9 months ago #

    Already tried that, just causes a redirect loop. Would of been nice if it was that easy.

  4. bangjoman73
    Member
    Posted 9 months ago #

    Found the coding. Tried and tested so it does not cause any redirect loops.

    RewriteCond %{THE_REQUEST} ^.*/index.html
    RewriteRule ^(.*)index.html$ http://www.WoweeSiteMe.com/$1 [R=301,L]
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
  5. The configuration works fine on my server. Glad you found a solution that works for you.

    redirect /index.html https://your-link-here.com/

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

    # END WordPress

Reply

You must log in to post.

About this Topic