vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to redirect non-www pages to www pages ? (https://vborg.vbsupport.ru/showthread.php?t=163710)

senaia 11-27-2007 10:42 AM

How to redirect non-www pages to www pages ?
 
Hello

I want to redirect all the non-www forum url's including the main page, to www. Is there a mod/hack to do this for me ?

I tried a few commands in .htaccess, the main page would be redirected but the rest the pages would give an error page.

Any advice/help is appreciated. Thank You.

Vinyljunky 11-27-2007 11:58 AM

I use In .htaccess

Code:

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

VinylJunky

senaia 11-29-2007 10:32 AM

Thanks but its not working for me.

Only the main page works and the non-www pages would give an error, instead of redirecting to www.

RedTyger 11-29-2007 11:10 AM

Try this, my version is rather more complicated because it's done for multiple domains but I think this is how it started out.

Code:

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


senaia 11-30-2007 05:45 AM

Quote:

Originally Posted by RedTyger (Post 1391607)
Try this, my version is rather more complicated because it's done for multiple domains but I think this is how it started out.

Code:

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


Hmm, nothing happens using this code. No errors or redirect or anything, it just stays the same. Anyway, thanks for taking the time to help :)

RedTyger 11-30-2007 09:02 AM

Wikipedia says this: http://en.wikipedia.org/wiki/No-www#Apache_example

Amenadiel 11-30-2007 12:34 PM

Quote:

Originally Posted by RedTyger (Post 1391607)
Try this, my version is rather more complicated because it's done for multiple domains but I think this is how it started out.

I believe this case is exactly the opposite, so it should go:

Code:

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



All times are GMT. The time now is 01:11 PM.

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.01156 seconds
  • Memory Usage 1,725KB
  • 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
  • (4)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete