Link to home
Start Free TrialLog in
Avatar of yarekGmail
yarekGmail

asked on

simple url rewriting

Hello experts;
I want to use this url rewriting (.htaccess)

http://www.mysite.com/ana

so it points to
http://www.mysite.com/artiste-bio.php?username=ana

Any clues ?

I use linux / apache / php
Avatar of Lukasz Chmielewski
Lukasz Chmielewski
Flag of Poland image

Try this:

RewriteRule http://www.mysite.com/([^/]*)$ http://www.mysite.com/artiste-bio.php?username=$1 [L]

Open in new window

Avatar of yarekGmail
yarekGmail

ASKER

does not seem to work.
Besides I just realized : it will work badly with files like /images /scripts /admin etc..
Do you have a suggestion to simplify this kind of url ?

http://www.mysite.com/artiste-bio.php?username=ana

Regards
What are you using the parameter for; a re-direct or query?


Cd&
for a SQL quesry
Okay you currently hit http://www.mysite.com/ana where it by default goes to http://www.mysite.com/ana/index.php

so why not do a php re-direct in index.php like this

header("Status: 301 Moved Permanently");

header("Location:http://www.mysite.com/artiste-bio.php?". $_SERVER['QUERY_STRING']);

Open in new window




Cd&
No,
I think I expressed myself badly

http://www.mysite.com/ana   goes to  http://www.mysite.com/artiste-bio.php?username=ana
http://www.mysite.com/john goes to  http://www.mysite.com/artiste-bio.php?username=john
etc...
except for
http://www.mysite.com/images/
http://www.mysite.com/scripts/
http://www.mysite.com/admin


Is it something that can be done with .htaccess ?

regards
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial