tags:

views:

6

answers:

1

Hi all,

I had to change the link structure on my site, and to maintain my SEO value I'm trying to setup some 301 rules based on htaccess.

My old setup was this:

http://www.domain.com/news/23/some-text-here

My new setup is this:

http://www.domain.com/read/some-text-here

RewriteCond ^(news)/([0-9]*)/(.*)$
RewriteRule ^(.*)$ http://www.domain.com/read/$3 [L,R=301]

The method above gives me server an internal server error. I hope someone can tell me what I'm doing wrong!

Thanks in advance

+1  A: 

Well for one, you're RewriteCond is missing a string to test against. The basic syntax is

RewriteCond TestString Pattern

For example:

RewriteCond %{REQUEST_URI} ^/(news)/([0-9]*)/(.*)$

See: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritecond and also make sure the rewrite engine is enabled before anything else:

RewriteEngine On
bosmacs
I actually have this before the two lines I posted:RewriteEngine onRewriteCond %{REQUEST_URI} !-f
kris
RewriteCond %{REQUEST_URI} ^/(news)/([0-9]*)/(.*)$RewriteRule ^(.*)$ http://www.domain.com/read/$3 [L,R=301]I'm having trouble filling the $3 - Can you possible tell me what I'm doing wrong?
kris
I figured it out!. Thanks for your help
kris