vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Force WWW with htaccess (https://vborg.vbsupport.ru/showthread.php?t=263718)

vBNinja 05-16-2011 12:56 PM

Force WWW with htaccess
 
hello


i want to force www on my forums so that if its typed without the "www" it automatically adds it

my forum not on the main domain, it is a subdomain so the code needs to be made to work within the directory where my forum is on

my forum is in a directory called "forums"

so basically: http://mysite.com/forums

i want everything within the that directory to automatically get the "www"

Can someone please help me


Thank You :)

Lynne 05-16-2011 02:41 PM

google is your friend (as is search since this has been covered many times before)

http://davidwalsh.name/no-www-using-htaccess-file

(examples for with or without www included in above link.)

vBNinja 05-16-2011 03:06 PM

ive tried those before but it would redirect:

http://mysite.com/forums/forum.php
to
http://www.mysite.com/forum.php

(leaving out my directory)

Lynne 05-16-2011 03:14 PM

If you are having problems, please post *exactly* what you used and then tell us the *exact* problem you are having with that code.

vBNinja 05-16-2011 05:03 PM

This is what i used and it just gave me the page not found error

Code:

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


Lynne 05-16-2011 08:49 PM

foruns? That isn't going to work. mydomain.com won't work either. That also doesn't look like the link I posted. I use something that looks very much like the stuff in the link I posted and it works fine.

Valter 05-16-2011 09:18 PM

This works for me:

Code:

Options +FollowSymLinks
RewriteEngine ON
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

Replace both instances of "domain.com" with your real domain.

vBNinja 05-17-2011 01:12 AM

Quote:

Originally Posted by Valter (Post 2196494)
This works for me:

Code:

Options +FollowSymLinks
RewriteEngine ON
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

Replace both instances of "domain.com" with your real domain.

i know that works only if your forums is installed in the root of your domain

my forum is in a directory within my domain

this is similar to my issue:
http://www.vbseo.com/f4/add-www-via-...-folder-42567/

Lynne 05-17-2011 05:18 PM

My forum is not installed in the root and that htaccess works fine for me. If you are using vbseo, then you will need to ask them for help with the issue.

vBNinja 05-17-2011 09:54 PM

Can you post your exact code so i can just replace it with my domain

Thank you


All times are GMT. The time now is 01:13 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01149 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete