Results 1 to 4 of 4

.htaccess question

This is a discussion on .htaccess question within the General Discussion forums, part of the vBSEO SEO Plugin category; so in my main directory, i have this for my .htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} ^domainname.com RewriteRule (.*) http://www.domainname.com/$1 ...

  1. #1
    Member
    Real Name
    Johnny
    Join Date
    Jun 2006
    Posts
    41
    Liked
    0 times

    .htaccess question

    so in my main directory, i have this for my .htaccess file:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domainname.com
    RewriteRule (.*) http://www.domainname.com/$1 [R=301,L]

    but then i noticed that if i removed the www from the forum link, it wouldn't redirect to the www (would explain why some members found themselves logged out?)

    and then i noticed there is an .htaccess file in my forum directory. is there suppose to be one? this is what it has:

    # Comment the following line (add '#' at the beginning)
    # to disable mod_rewrite functions.
    # Please note: you still need to disable the hack in
    # the vBSEO control panel to stop url rewrites.
    RewriteEngine On

    # Some servers require the Rewritebase directive to be
    # enabled (remove '#' at the beginning to activate)
    # Please note: when enabled, you must include the path
    # to your root vB folder (i.e. RewriteBase /forums)
    #RewriteBase /

    #RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com
    #RewriteRule (.*) http://www.yourdomain.com/forums/$1 [L,R=301]

    RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

    RewriteCond %{QUERY_STRING} !vbseourl=
    RewriteCond %{REQUEST_URI} !(admincp/|modcp/|chat|cron)
    RewriteRule ^(.*\.php)$ vbseo.php?vbseourl=$1 [L,QSA]

    RewriteCond %{REQUEST_FILENAME} !\.(jpg|gif)$
    RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/
    RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]



    is there anything i need to change? i just moved servers and things were really screwy after the move.

  2. #2
    Senior Member
    Real Name
    Michael Biddle
    Join Date
    Jan 2007
    Location
    Southern California
    Posts
    7,097
    Liked
    5 times
    #RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com
    #RewriteRule (.*) http://www.yourdomain.com/forums/$1 [L,R=301]

    Remove the # and it should always make it add the www. to the beginning.

    Be sure you change yourdomain with your current one
    The Forum Hosting - Forum Hosting from the Forum Experts

  3. #3
    Member
    Real Name
    Johnny
    Join Date
    Jun 2006
    Posts
    41
    Liked
    0 times
    so it's okay to have 2 htaccess files? (one in the main directory and this one in the /forum directory?).

  4. #4
    vBSEO Staff Ace Shattock's Avatar
    Real Name
    Ace Shattock
    Join Date
    Jul 2005
    Location
    Auckland, New Zealand, New Zealand
    Posts
    4,011
    Liked
    13 times
    Johnny,

    .htaccess files affect the folder they are in and all folders under that folder UNLESS a sub-folder contains its own .htaccess file, in which case that file will override completely the parent folder's .htaccess.

Similar Threads

  1. Hotlink Protection Tutorial (Apache Server - .htaccess files)
    By NeutralizeR in forum Member Articles
    Replies: 15
    Last Post: 06-08-2011, 02:25 PM
  2. .htaccess confusion!
    By rlpartida in forum General Discussion
    Replies: 11
    Last Post: 06-29-2007, 09:13 PM
  3. installing sitemap .htaccess question
    By sovaward in forum General Discussion
    Replies: 19
    Last Post: 12-22-2006, 03:00 PM
  4. .htaccess question
    By Aneurysm in forum General Discussion
    Replies: 1
    Last Post: 12-05-2006, 02:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •