• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Redirect to www

Sylar

Well-known member
#1
Okay, so I read the topic that was supposed to have the fix for this in it, but it didn't work. Here is my htaccess file:
Code:
#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
#<IfModule mod_security.c>
#    SecFilterEngine Off
#    SecFilterScanPOST Off
#</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 500 default

<IfModule mod_rewrite.c>
    RewriteEngine On

        RewriteCond %{HTTP_HOST} ^promotion-box\.com [NC]
        RewriteRule ^(.*)$ http://www.promotion-box.com/$1 [R=301,L]

        RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data|js|styles|install) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>
What is wrong with it? Because promotion-box.com is not redirecting to www.promotion-box.com
 

User

Well-known member
#4
Your server needs to have the mod_rewrite module installed <IfModule> just means that IF the module exists then do whatever is within the tag. The tag itself looks fine, so either the module isn't being loaded or it's not installed. Depending on the Apache version you should have a LoadModule command in the httpd.conf which has mod rewrite in it, something like this:

LoadModule rewrite_module modules/mod_rewrite.so

Are you on shared or vps/dedicated hosting? If you don't have access to your httpd.conf file you can just replace your current htaccess file with one that reads:

Code:
RewriteEngine On
RewriteRule ^google.html$ http://www.google.com/ [R=301]
and go to www.promotion-box.com/google.html and you should end up at Google. If that doesn't work then you don't have mod rewrite installed. If you are on shared then you'll need to talk to your host about it, if you are on managed vps/dedicated then have them install it for you. If you are on unmanaged ..., well then google for how to install mod rewrite for your apache version.

One more edit, the code you copied does actually look like a httpd.conf file, not something that goes into htaccess, but I am not expert at this. You could try to eliminate the <IfModule> and see whether that works. Which web site did you read those instructions on?
 

Sylar

Well-known member
#5
I have pretty much no clue what you just said. Very sorry that I am a n00b at this sort of thing. Is there some simpler terms or steps I can follow?
 

User

Well-known member
#6
Looks like you are hosted by CorporatePride, which appears to be a reseller of SingleHop.net, submit a ticket to CorporatePride and have them fix it.