• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

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
0
yarekGmail
Asked:
yarekGmail
  • 3
  • 3
1 Solution
 
Lukasz ChmielewskiCommented:
Try this:

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

Open in new window

0
 
yarekGmailAuthor Commented:
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
0
 
COBOLdinosaurCommented:
What are you using the parameter for; a re-direct or query?


Cd&
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
yarekGmailAuthor Commented:
for a SQL quesry
0
 
COBOLdinosaurCommented:
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&
0
 
yarekGmailAuthor Commented:
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
0
 
COBOLdinosaurCommented:
If the rewrite that Roads_Roads does not do it than I have no idea.

What I gave you should work, but you have to set up the index.php for each of their directories.

You are doing a major structural change in the file system, so there is some work involved.

I wish I had more for you.  There may be some other rewrite rule that could be used but I don't use rewrite enough to be definitive about whether it is possible.


Cd&


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now