Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

redirect with mod_rewrite

Status
Not open for further replies.
Do you want a mask or a redirect?

one way is to mask it so the user sees the /this/that url and the server sees /page.php?action=that or whatever. You can achieve that by doing something like the following:

Code:
RewriteCond %{REQUEST_URI} ^/people/
RewriteRule ^/people/(.*) /people.php?username=$1&%{QUERY_STRING}

That will point anything in /people/ to the php page with username and attached extra query string.

The other way is to have it redirect them to the php request rather than masking, so the url changes from /people/username to /people.php?username=whatever at the client end. You can do that by adding the [R] option.

Code:
RewriteCond %{REQUEST_URI} ^/people/
RewriteRule ^/people/(.*) /people.php?username=$1&%{QUERY_STRING} [R]

let me know if you have any other questions.

Steve Kiehl
Nanovox Productions
The Fantasy Artist that is Zeadi
 
Thank you for your reply!

Yes i have a question:how to install mod_rewrite on my server ?
 
Depends on the server's operating system and what web server you're running. In apache you can find out what compiled in modules there are by running the following from the web server's bin directory:

httpd -l

If you don't see "mod_rewrite.c" in that list, check to see if "mod_rewrite.so" is in the Apache server's module directory.

If you're not in charge of running the Apache server, you may want to consult the administrators and see if it's installed or if they can have it installed.

Steve Kiehl
Nanovox Productions
The Fantasy Artist that is Zeadi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top