views:

25

answers:

2

Hello, this is probably simple but i don't know how to do it.

I want all links of this form: http://www.fractalbit.gr/archives/xxx to redirect to this: http://www.fractalbit.gr/?p=xxx

+1  A: 

Something like this?

RewriteEngine on
RewriteRule ^archives/(.+)$ ?p=$1

All depends however, a lot on whether you are allowed to use .htaccess in such a way. Stuff like this is not always permitted by webhosts.

PS: this is called rewriting as opposed to redirecting, but I think this is what you mean.

Jochem
This is probably correct but it does not work as intended and it is my fault, i should have said that i am using wordpress and i already have an .htaccess file with the followin contents# BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]</IfModule># END WordPress<IfModule mod_suphp.c># Use PHP5 as defaultAddHandler application/x-httpd-php5 .php </IfModule>
fractalbit
Well that explains. Good to see that another answer did help you out!
Jochem
+1  A: 
RedirectMatch .*\/archives\/(.+) http://www.fractalbit.gr/?p=$1

RedirectMatch in Apache docs

lashtal
Thanks, this worked like a charm :)
fractalbit