views:

63

answers:

2

Hi, I'm using htaccess rewrite engine to make urls look nice, from www.mysite.com/index.php?pag=home to www.mysite.com/pag/home

it works fine with this rule

RewriteRule ^pag/([^/]+)$ index.php?pag=$1 [L,QSA,NC]

but when I go to www.mysite.com it redirects me to www.mysite.com/index.php is there a way to redirect to www.mysite.com/pag/home?

I tried

redirect 301 /index.php http://www.mysite.com/pag/home

but when i try to go to www.mysite.com the browser gives my "page do not exsist error"

A: 

This is the rule that Drupal uses to make it's pretty urls, yours should be extremely similar: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Your rule only matches on urls that have pag in them, but you're really wanting to hit every url.

Chuck Vose
not really because I've got some independent services on subfoldersso I do not want that when you go to mysite.com/service1 it redirect to www.mysite.com/index.php?pag=service1
Gusepo
Ah, I understand. You can still use the rule but you'll have to be a little more explicit about how you want it to redirect. Using ^$ instead of ^(.*)$ would target only the empty URL.
Chuck Vose
A: 

the problem was in this redirect rule

redirect 301 /index.htm http://www.mysite.com/index.php
Gusepo