Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 17th, 2006, 7:36 PM   #1
Arachnd
Newbie
 
Join Date: Jan 2006
Posts: 1
Rep Power: 0 Arachnd is on a distinguished road
rewrite help

is it possible to create a rewrite rule so that if
http://www.host.com/imr/user?=user
can actually be http://www.host.com/user ?

Really need help understanding these rules

Thanks,
Arachn1d
Arachnd is offline   Reply With Quote
Old Jan 18th, 2006, 12:13 AM   #2
Lich
Professional Programmer
 
Lich's Avatar
 
Join Date: May 2005
Location: Detroit
Posts: 254
Rep Power: 4 Lich is on a distinguished road
Send a message via AIM to Lich Send a message via MSN to Lich
try
[PHP]
if($_GET['user'])
{
header("Location: http://www.host.com/user");
}
[/PHP]

or if you want user in the url to be the user variable, you can use

[PHP]
if($_GET['user'])
{
header("Location: http://www.host.com/$_GET['user']");
}
[/PHP]
__________________
--John Cruz
Web Developer
www.cruzweb.net
Lich is offline   Reply With Quote
Old Jan 18th, 2006, 12:34 PM   #3
BlazingWolf
Hobbyist Programmer
 
Join Date: Sep 2004
Posts: 206
Rep Power: 4 BlazingWolf is on a distinguished road
You can also do it using Apache's mod_rewrite although I can't give you exact code because the on time I tried to understand it I didn't get it.

You might try

http://www.sitepoint.com/article/guide-url-rewriting
http://www.phpfreaks.com/tutorials/23/0.php
__________________
_______________________________
BlazingWolf
BlazingWolf is offline   Reply With Quote
Old Jan 19th, 2006, 2:26 PM   #4
niteice
Programmer
 
niteice's Avatar
 
Join Date: Aug 2005
Posts: 98
Rep Power: 3 niteice is on a distinguished road
Send a message via AIM to niteice
add a basic .htaccess to your web directory containing the following:

RewriteEngine On
RewriteRule ^(.*)$ /imr/user?user=$1 [L,QSA]
niteice is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:50 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC