Quantcast
Channel: TechSpotting » .htaccess
Viewing all articles
Browse latest Browse all 2

htaccess 301 Redirect Pages or entire Site

0
0

This is the easiest way I have found to redirect a website or blog using the .htaccess file, for this to work you need to be using Apache hosting (if you are unsure, chances are you will be using Linux & Apache!).

Login to your web server via FTP or SSH and look in the root of your website, where your index.php / index.html files are stored and look for a file called .htaccess (Note you might have to enable show hidden files in your FTP client, on the command line for SSH you would type “ls -la” to show all files).

Edit the file if it exists, if you are using WordPress or another CMS chances are you will already have a .htaccess file. If you don’t then create it and add the following option that applies:

htaccess 301 Redirect an entire site

redirect 301 / http://www.newsite.com/

htaccess 301 Redirect an internal page or directory

I do this quite often in WordPress, for example I made a type on a post permalink so I used a 301 redirect and changed the corrected the name of the post.

htaccess 301 Redirect a web page

redirect 301 /blah.html http://www.yoursite.com/new.html

htaccess 301 Redirect a Permalink or directory

If you’re using WordPress you should be using Permalinks, therefor your pages won’t have extensions like .php .html (that are visible). To redirect the you need to do the following:

redirect 301 /old-post-name http://www.yourblog.com/new-post-name

That’s it! Don’t forget to subscribe to our RSS feed for more useful guides & HowTo’s, if you have any questions please post a comment!

Technorati Tags: .htaccess, 301 Redirect, Apache, blog, How-To, HowTo, Linux, Web site, WordPress


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images