.htaccess mod rewrite


#1

Hi All,

I’m trying to redirect the following:
from: http://www.toptier.com.br/?page_id=7
to: http://www.toptier.com.br/blog

I’ve tried a bunch of combinations such as:
RewriteRule ^blog /?page_id=7 [QSA,L]

Any suggestions? Thanks in advance.


#2

you mean when someone goes to http://www.toptier.com.br/blog you want it to load /?page_id=7 instead, right?

try /index.php?page_id=7 or whatever file is actually being used when you go to /?page_id=7. you can also try being less specific with what you’re trying to match, like blog instead of ^blog.

track7 - my dream-hosted site


#3

Assuming I’m reading your post right, you’ve got the RewriteRule backwards. The rule you’ve written will redirect from /blog to /?page_id=7, whereas your post says you want the opposite to happen. Try flipping around the RewriteRule!


#4

Well I used the following sentence and it still doesn’t work.

RewriteRule /?page_id=$7 /news [QSA,L]

Any suggestions? Tks.


#5

It should be something more like:

RewriteEngine On RewriteRule ^blog/?$ index.php?page_id=7


#6

Solution:

RewriteCond %{QUERY_STRING} ^page_id=7$ RewriteRule ^$ /news? [R]Query strings (?stuff) aren’t part of the URL, so you can’t match them directly in a RewriteRule.