.htaccess tutorial

htaccess Elite


How to shorten links in Wordpress

Ask your mod_rewrite and Redirection questions here, and get answers!

How to shorten links in Wordpress

New postby Yohay » 07 Apr 2007 00:16

Hi,

I'm running a blog in this address:
http://things.co.il/blog

I'm already using Wordpress' permalinks so that posts have a short link such as http://things.co.il/blog/364

I want to move the Wordpress installation to the root of my domain, but I don't want to lose the current links.

How can I modify the .htaccess file so that http://things.co.il/blog/364 will still work alongside http://things.co.il/364 after I move Wordpress installation to the root of the domain?

Thanks in advance,

Yohay.
Yohay
 
Posts: 1
Joined: 07 Apr 2007 00:07

New postby produke » 10 Apr 2007 04:30

Well I would recommend that you avoid duplicate content punishment in the search engines by blocking /blog in your robots.txt file.
Code: Select all
User-agent:  *
Disallow: /blog/


Then in your htaccess file you should add this above your <IfModule mod_rewrite>

Code: Select all
RedirectMatch 301 ^/blog/(.*)$ http://www.site.com/$1
User avatar
produke
 
Posts: 242
Joined: 25 Sep 2006 04:48


Return to Redirect or Rewrite Questions