Jump to content

mod_rewrite for board SEO and to force no www. Any tips?


Recommended Posts

I used to use the following code on my website to force all traffic to use no www in the URL.

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www.ncaastrategies.com$

RewriteRule ^(.*)$ http://ncaastrategies.com/$1 [R=301,L]

ipBoard calls for me to add the following information to my .htaccess file.

<IfModule mod_rewrite.c>

Options -MultiViews

RewriteEngine On

RewriteBase /utopia/

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /utopia/index.php [L]

</IfModule>

Using both snippets in my .htaccess file like so does not provide the result I would hope for. Instead of redirecting to the same URL minus the www - it instead redirects to the forum index.

<IfModule mod_rewrite.c>

Options -MultiViews

RewriteEngine On

RewriteBase /utopia/

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /utopia/index.php [L]

</IfModule>


RewriteEngine On

RewriteCond %{HTTP_HOST} ^www.ncaastrategies.com$

RewriteRule ^(.*)$ http://ncaastrategies.com/$1 [R=301,L]



Could someone please help me in making it so that the ipBoard rule works in tandem with a no www redirect?

Thanks!

Link to comment
Share on other sites

Special thanks to Ryan Dwyer of Ubuntu Forums for simplifying this for me.

<IfModule mod_rewrite.c>

Options -MultiViews

RewriteEngine On


RewriteCond %{HTTP_HOST} ^www.ncaastrategies.com$

RewriteRule ^(.*)$ http://ncaastrategies.com/$1 [R=301,L]


RewriteBase /utopia/

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /utopia/index.php [L]

</IfModule>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...