extremephp
BANNED
- Oct 19, 2010
- 1,288
- 1,281
I thought, this would help some people, atleast some who doesnt Google much!
How to Save an Htaccess file
1.Open Notepad
2.Type in the Htaccess commands
3. File > Save
4.remove .txt and type .htaccess
5. From File type, select All Files.
6. Save
7. Done!
Q: I see my site having 100 backlinks with WWW and 10 Without WWW
A : 301 Redirect WWW to Non WWW or Vice Versa!
WWW to Non WWW
#Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^sitenamehere.com
RewriteRule ^(.*) http://www.sitenamehere.com/$1 [R=301,L]
Non WWW to WWW
#Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^http://www.sitenamehere.com
RewriteRule ^(.*) http://sitenamehere.com/$1 [R=301,L]
Q: I bought an SSL! And I want to force my url to be https://
A: Can be done with out without WWW. (codes below)
Non WWW to WWW with Https
#Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^sitenamehere.com
RewriteRule ^(.*) https://www.sitenamehere.com/$1 [R=301,L]
WWW to Non WWW with Https
#Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^http://www.sitenamehere.com
RewriteRule ^(.*) https://sitenamehere.com/$1 [R=301,L]
Q : I dont want my site to come with .html, .php extensions
A: Can easily be hidden!
Hiding Page Extentions
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Replace .php with .html .txt or whatever you need to hide!
Q: Google deindexed my site. I need all the link juice to my new site. And I dont want to break the old urls.
A: 301 olddomain.com/page to newdomain.com/page . Kick Googles Butt using this htaccess mod!
Domain.com/page to newdomain.com/page
#Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.yourolddomain.com$[OR]
RewriteCond %{HTTP_HOST} ^yourolddomain.com$
RewriteRule ^(.*)$ http://www.yournewdomain.com/$1 [R=301,L]
Am not a pro in htaccess, but if you have some problems with this, Ask loud!
~ExP~
How to Save an Htaccess file
1.Open Notepad
2.Type in the Htaccess commands
3. File > Save
4.remove .txt and type .htaccess
5. From File type, select All Files.
6. Save
7. Done!
Q: I see my site having 100 backlinks with WWW and 10 Without WWW
A : 301 Redirect WWW to Non WWW or Vice Versa!
WWW to Non WWW
#Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^sitenamehere.com
RewriteRule ^(.*) http://www.sitenamehere.com/$1 [R=301,L]
Non WWW to WWW
#Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^http://www.sitenamehere.com
RewriteRule ^(.*) http://sitenamehere.com/$1 [R=301,L]
Q: I bought an SSL! And I want to force my url to be https://
A: Can be done with out without WWW. (codes below)
Non WWW to WWW with Https
#Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^sitenamehere.com
RewriteRule ^(.*) https://www.sitenamehere.com/$1 [R=301,L]
WWW to Non WWW with Https
#Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^http://www.sitenamehere.com
RewriteRule ^(.*) https://sitenamehere.com/$1 [R=301,L]
Q : I dont want my site to come with .html, .php extensions
A: Can easily be hidden!
Hiding Page Extentions
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Replace .php with .html .txt or whatever you need to hide!
Q: Google deindexed my site. I need all the link juice to my new site. And I dont want to break the old urls.
A: 301 olddomain.com/page to newdomain.com/page . Kick Googles Butt using this htaccess mod!
Domain.com/page to newdomain.com/page
#Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.yourolddomain.com$[OR]
RewriteCond %{HTTP_HOST} ^yourolddomain.com$
RewriteRule ^(.*)$ http://www.yournewdomain.com/$1 [R=301,L]
Am not a pro in htaccess, but if you have some problems with this, Ask loud!
~ExP~