vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   How to redirect site.com to www.site.com? (https://vborg.vbsupport.ru/showthread.php?t=255066)

Bouncer222 12-11-2010 02:42 PM

How to redirect site.com to www.site.com?
 
As the title says... How to redirect site.com to www.site.com?

How would I go about doing this? my site is www.fragtoss.com so how would I make it so that when people type fragtoss.com it sends them to www.fragtoss.com ?

Thanks.

K!nG 12-11-2010 02:47 PM

That's something that will happen automatically when ppl will type fragtoss.com their browser will automatically take them to your homepage with as http://fragtoss.com

Bouncer222 12-11-2010 02:51 PM

Well since I'm asking how to do it, it's obviously not happening :)

K!nG 12-11-2010 03:07 PM

what server your website is hosted on ?? Windows / Linus ? i can try to help u once i know that or u can do that on ur own by redirecting 301 nonwww to www url. u can search for .... 301redirect also on ur own if u want.

Bouncer222 12-11-2010 03:30 PM

mine is linux

Weetabix 12-11-2010 04:09 PM

You can use htaccess to do this;

http://snippetdb.com/htaccess/add-www

very very very very useful little file, capable of tons of great stuff. If you've never used it before, visit http://www.askapache.com/ for usage and examples.

Bouncer222 12-11-2010 07:38 PM

So where should I place...

Code:

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

In this, which is my .htaccess file?

Code:

# 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 %{REQUEST_URI} !(admincp/|modcp/|cron|vbseo_sitemap)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA]

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

## Expires
<ifModule mod_expires.c>
        ExpiresActive On
        ExpiresDefault "access plus 1 seconds"
        ExpiresByType text/html "access plus 1 seconds"
        ExpiresByType image/gif "access plus 3456000 seconds"
        ExpiresByType image/jpeg "access plus 3456000 seconds"
        ExpiresByType image/png "access plus 3456000 seconds"
        ExpiresByType text/css "access plus 3456000 seconds"
        ExpiresByType text/javascript "access plus 3456000 seconds"
        ExpiresByType application/javascript "access plus 3456000 seconds"
        ExpiresByType application/x-javascript "access plus 3456000 seconds"
</ifModule>

## Compression
<ifmodule mod_headers.c>
        <ifmodule mod_deflate.c>
                AddOutputFilterByType DEFLATE text/html text/css text/xml application/x-javascript
                BrowserMatch ^Mozilla/4 gzip-only-text/html
                BrowserMatch ^Mozilla/4\.0[678] no-gzip
                BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
        </ifmodule>
</ifmodule>

## Rewrites
<ifmodule mod_rewrite.c>
        RewriteEngine on
        Options +FollowSymlinks

        RewriteCond %{REQUEST_FILENAME} -s [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^.*$ - [NC,L]

        # Media Library
        ReWriteRule ^media/m(\d+).*/tags$ media.php?do=tags_edit&mid=$1 [QSA]
        ReWriteRule ^media/m(\d+).*/edit$ media.php?do=details_edit&mid=$1 [QSA]
        ReWriteRule ^media/m(\d+).*/report$ media.php?do=report&mid=$1 [QSA]
        ReWriteRule ^media/m(\d+).*/c(\d+)$ media.php?do=comment_edit&cmt=$2 [QSA]
        ReWriteRule ^media/m(\d+).*/p(\d+).*$ media.php?do=details&mid=$1&pid=$2 [QSA]
        ReWriteRule ^media/m(\d+).* media.php?do=details&mid=$1 [QSA]
        ReWriteRule ^media/p(\d+).*/edit$ media.php?do=playlist_edit&pid=$1 [QSA]
        ReWriteRule ^media/p(\d+).* media.php?do=playlist&pid=$1 [QSA]
        ReWriteRule ^media/c(\d+).* media.php?do=category&cid=$1 [QSA]
        ReWriteRule ^media/u(\d+).* media.php?do=user&uid=$1 [QSA]
        ReWriteRule ^media/tag/(.*) media.php?do=tag&tid=$1 [QSA]
        ReWriteRule ^media/results/(.*) media.php?do=results&query=$1 [QSA]
        ReWriteRule ^media/advresults/(.*) media.php?do=advresults&query=$1 [QSA]
        ReWriteRule ^media/letter/(.*) media.php?do=letter&query=$1 [QSA]
        ReWriteRule ^media/browse.* media.php?do=browse [QSA]
        ReWriteRule ^media/search.* media.php?do=search [QSA]
        ReWriteRule ^media/random.* media.php?do=random [QSA]
        ReWriteRule ^media/submit.* media.php?do=submit [QSA]
        ReWriteRule ^media/tagcloud.* media.php?do=tagcloud [QSA]
        ReWriteRule ^media/playlists.* media.php?do=playlists [QSA]
        ReWriteRule ^media/pcreate.* media.php?do=playlists_create [QSA]
        ReWriteRule ^media/pmine.* media.php?do=playlists_mine [QSA]
        ReWriteRule ^media/favorites.* media.php?do=favorites [QSA]
        ReWriteRule ^media/subscriptions.* media.php?do=subscriptions [QSA]
        ReWriteRule ^media/admin/edit/s(\d+).* media.php?do=admin_host_edit&sid=$1 [QSA]
        ReWriteRule ^media/admin/delete/s(\d+).* media.php?do=admin_host_delete&sid=$1 [QSA]
        ReWriteRule ^media/admin/export/s(\d+).* media.php?do=admin_host_export&sid=$1 [QSA]
        ReWriteRule ^media/admin/(\w+).* media.php?do=admin_$1 [QSA]

        # Media Library from Video Directory
        RewriteCond %{QUERY_STRING} do=viewdetails&videoid=(\d+)
        RewriteRule ^video\.php$ media.php?do=details&mid=%1
        RewriteCond %{QUERY_STRING} viewcategory&categoryid=(\d+)
        RewriteRule ^video\.php$ media.php?do=category&cid=%1
        RewriteCond %{QUERY_STRING} viewuser&userid=(\d+)
        RewriteRule ^video\.php$ media.php?do=user&uid=%1
        RewriteCond %{QUERY_STRING} viewtag&tag=(.*)
        RewriteRule ^video\.php$ media.php?do=tag&tid=%1
        ReWriteRule ^video\.php$ media.php

        # Forum
        RewriteRule ^threads/.* showthread.php [QSA]
        RewriteRule ^forums/.* forumdisplay.php [QSA]
        RewriteRule ^members/.* member.php [QSA]
        RewriteRule ^blogs/.* blog.php [QSA]
        ReWriteRule ^entries/.* entry.php [QSA]

        RewriteCond %{REQUEST_FILENAME} -s [OR]
        RewriteCond %{REQUEST_FILENAME} -l [OR]
        RewriteCond %{REQUEST_FILENAME} -d
        RewriteRule ^.*$ - [NC,L]

        # MVC
        RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA]
</ifmodule>


Weetabix 12-11-2010 08:36 PM

You only need to use the 'RewriteEngine On' once, and you can stick that extra bit anywhere underneath it. Something like this;

Code:

RewriteEngine On

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

# 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 %{REQUEST_URI} !(admincp/|modcp/|cron|vbseo_sitemap)
RewriteRule ^((archive/)?(.*\.php(/.*)?))$ vbseo.php [L,QSA]


preemz10314 12-11-2010 08:45 PM

bro..why are you ppl telling this man such a complicated answer to an easy question.

Login to your host cpanel (not your vbulletin cpanel but your actual cpanel) , navigate to where you see redirects, then just add it there.

Weetabix 12-11-2010 08:47 PM

Not every host has cpanel. I don't.

How on Earath is adding 2 lines of code into a pre-existing file considered complicated? If anyone has trouble with this, then installing mods or editing templates is gonna be quite a challenge. Besides, htaccess is a feather in any webmaster's cap.


All times are GMT. The time now is 06:46 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.01687 seconds
  • Memory Usage 1,755KB
  • 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)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