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

Changed URL. http://www.myboard works but http://myboard.com doesnt

DRE

Well-known member
#3
This is the only thing in my .htaccess.

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
 
    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo
 
    #    This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
 
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>

I could've sworn I had way more stuff in there before. :eek:
 

CTXMedia

Formerly CyclingTribe
#5
What web server are you using, and do you have the non-www address aliased in your web server directive config?
 

DRE

Well-known member
#6
What web server are you using, and do you have the non-www address aliased in your web server directive config?
I use urljet and they have lightspeed.

http://xenforo.com/community/threads/htaccess-non-www-to-www.7105/

I used this code just now right under 'rewrite on'

Code:
    RewriteCond %{HTTP_HOST} ^url\.com [NC]
    RewriteRule ^(.*)$ http://www.url.com/$1 [R=301,L]
But I have several subdomains. What rewrite rules enforces www.url.com only? I need it to redirect from url.com to www.url.com
 

CTXMedia

Formerly CyclingTribe
#7
You can specify multiple domains and subs to rewrite to your www URL - give this example a try:

Code:
Options -Indexes +Includes

#       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

        #       If you are having problems with the rewrite rules, remove the "#" from the
        #       line that begins "RewriteBase" below. You will also have to change the path
        #       of the rewrite to reflect the path to your XenForo installation.
        #RewriteBase /xenforo

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

RewriteCond %{HTTP_HOST} ^sub\.url\.co\.uk$ [NC]
RewriteRule ^(.*)$ http://www.url.com/$1 [R=301,L]

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

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

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

RewriteCond %{HTTP_HOST} ^different\.url\.net$ [NC]
RewriteRule ^(.*)$ http://www.url.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>
 

DRE

Well-known member
#8
okay great, do I change url with my actual url

and i'm basically needing these rewrite rules for two different sites, one that is my main domain which is a myforum.com site

and one of my subdomains, which is a myforum.net site. Do I use that code for the myforum.com site

and when using the code for the myforum.net site just change the example so that its myforum.net?
 

CTXMedia

Formerly CyclingTribe
#9
okay great, do I change url with my actual url
Yes.

and i'm basically needing these rewrite rules for two different sites, one that is my main domain which is a myforum.com site

and one of my subdomains, which is a myforum.net site. Do I use that code for the myforum.com site

and when using the code for the myforum.net site just change the example so that its myforum.net?
Let's do it backwards - what is the destination URL - where you want all the requests to end up?
 

DRE

Well-known member
#10
Yes.



Let's do it backwards - what is the destination URL - where you want all the requests to end up?
I have two domains. The main domain is www.the8thlegion.com

That's working fine now except people can access the site through http://the8thlegion.com

When they go to that url, they are logged out. It does not save their cookies.

So It used to work both ways but it doesn't anymore.

I want to force www.the8thlegion.com instead of letting people go to the site through http://the8thlegion.com


Alright that's one issue.

The other issue is the same as above except this one is called www.blackgamer.net and is a subdomain underneath the8thlegion.com
 

CTXMedia

Formerly CyclingTribe
#11
Cookies apply to the URL that someone logs in at - so if you login at "www.site.com" the cookie won't apply if you visit the site via "site.com".

Anyway, for the8thlegion try this:

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
 
        #      If you are having problems with the rewrite rules, remove the "#" from the
        #      line that begins "RewriteBase" below. You will also have to change the path
        #      of the rewrite to reflect the path to your XenForo installation.
        #RewriteBase /xenforo
 
RewriteCond %{HTTP_HOST} ^the8thlegion\.com$ [NC]
RewriteRule ^(.*)$ http://www.the8thlegion.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>
 

DRE

Well-known member
#16
Cookies apply to the URL that someone logs in at - so if you login at "www.site.com" the cookie won't apply if you visit the site via "site.com".

Anyway, for the8thlegion try this:

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
 
        #      If you are having problems with the rewrite rules, remove the "#" from the
        #      line that begins "RewriteBase" below. You will also have to change the path
        #      of the rewrite to reflect the path to your XenForo installation.
        #RewriteBase /xenforo
 
RewriteCond %{HTTP_HOST} ^8thos\.com$ [NC]
RewriteRule ^(.*)$ http://www.8thos.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>
This worked out great thanks! Also worked with this config edit

Add this code to your library/config.php file to set your own cookie domain:

Examples include:

Code:
// COOKIES WILL ONLY WORK ON www.yoursite.com
$config['cookie'] = array(
'prefix' => 'xf_',
'path' => '/',
'domain' => 'www.yoursite.com'
);