Recent Topics

1 Mar 02, 2009 04:00    

First you have to create a file named .htaccess (note the leading dot) in your blog root directory. If you already have a sample.htaccess file which comes with b2evo, rename it to .htaccess

If you don't know what this file does, take a look at this manual http://httpd.apache.org/docs/1.3/howto/htaccess.html

Ok, let's start. In order to enable redirects you must put these 2 lines in top of the file.

RewriteEngine On
Options +FollowSymLinks

1. Then if you want to redirect all non-www requests to www copy the following code in .htaccess

# Redirect non-www to www
RewriteCond %{HTTP_HOST} !^www\.(.*)
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]

2. If you want to redirect all www requests to non-www use the following

# Redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule (.*) http://%1/$1 [R=301,L]

Thanks to ¥åßßå for the code snippets, you can also blame him if they don't work :)

2 Apr 24, 2009 21:05

sam2kb wrote:

First you have to create a file named .htaccess (note the leading dot) in your blog root directory. If you already have a sample.htaccess file which comes with b2evo, rename it to .htaccess ...

Point worth noting: make absolutely certain you do not already have a .htaccess file before you create and upload one, or rename sample.htaccess!

Many FTP clients and host-provided file manager tools will hide files that begin with a dot, so be sure to check and set your method of viewing files on your server to show hidden files. Also be aware that many hosts will use .htaccess to take care of some of the things you can do from your cpanel (or other host interface tool). Things like hot-link enabling, IP banning, adding addon domains, and probably others are usually done by adding bits to your .htaccess file whether you can see that file or not.

Therefore it is in your best interests to first make sure if you do or do not already have that possibly hidden file, and if so to know that what you and your host add to it MIGHT conflict one day. ALWAYS have backup files!

3 Apr 10, 2015 08:47

what if we are changing the domain?

from

mywebsite.com/blog1.php

to

archives.mywebsite.com

4 Apr 13, 2015 23:11

Hi @lucilove,

If blog1.php won't be used anymore in your main domain, you can use this simple rule in your .htaccess file


	RewriteCond %{REQUEST_URI} ^\/blog1\.php(.*)
	RewriteRule (.*) http://archives.example.com/$1 [R=301,L]

Just remember to put it inside the <IfModule mod_rewrite.c> block.


Form is loading...