Hướng dẫn đưa domain từ none-www về www

nttruong

MasterCorporal
Tham gia
25/02/2015
Bài viết
368
Được Like
614
Đây là bài viết hướng dẫn đưa domain từ none-www về www.

Cách làm:


Các bạn mở file .htaccess tìm:

Mã:
<IfModule mod_rewrite.c>
RewriteEngine On

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>

Thay bằng:

Mã:
<IfModule mod_rewrite.c>
RewriteEngine On

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

Thay example.com bằng domain của bạn nhé!

Chúc thành công!
 

THB

Founder
Thành viên BQT
Tham gia
25/02/2015
Bài viết
6,650
Được Like
3,939
cái này nên chọn cái www hay là non-www thì seo tốt hơn?:D
 

Jindo_Katori

FirstSergeant
Tham gia
01/03/2015
Bài viết
1,462
Được Like
1,205
cái này nên chọn cái www hay là non-www thì seo tốt hơn?:D
Cái này có nhiều luận điểm tranh cãi khác nhau lắm bác.
Còn em cứ thích ngắn nên chơi ngắn.
Mà em thử làm ngược lại nhưng không được
www.tuyhoaplus.com nó vẫn là www.tuyhoaplus.com (không mất www)

Mã:
#    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>


RewriteEngine on
#Redirect contents of previous Xenforo directory to root
RewriteRule ^forums/threads(.*)$ /threads$1 [R=301,NC,L]
RewriteRule ^forums/forums(.*)$ /forums$1 [R=301,NC,L]
RewriteRule ^forums/posts(.*)$ /posts$1 [R=301,NC,L]
RewriteRule ^forums/members(.*)$ /members$1 [R=301,NC,L]
#One more fix from stackoverflow to fix dead /forums and /forums/ links
RewriteRule ^forums/?$ $1 [L,R=301]
#vBSEO to vBulletin URLs
RewriteRule [^/]+/([\d]+)-.+-([\d]+).html showthread.php?t=$1&page=$2 [NC,L]
RewriteRule [^/]+/([\d]+)-.+.html showthread.php?t=$1 [NC,L]
#suggested on stackoverflow to fix pre-2004 URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule    ^/showthread.php?threadid=(.*)$ /threads/$1 [L,R=301]
RewriteRule    ^/showthread.php?s=&postid=(.*)$    /posts/$1 [L,R=301]
# redirect www.site.com to site.com
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.tuyhoaplus\.com
RewriteRule (.*) http://tuyhoaplus.com/$1 [R=301,L]


ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 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|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>
 
Sửa lần cuối:
  • Like
Reactions: THB

Hướng dẫn sử dụng

XenForo 1 XenForo 2
Translate by PVS

Dịch vụ XenForo của VNXF

Mr. Tuấn

Mobile/Zalo: 0988 488 096

Telegram: bluekpro

Email: [email protected]

Nhà Tài Trợ

Mút Xốp Không Gian
pallet Thịnh Phát
Top Bottom