Name Space

New to mod_rewrite? This is a good place to start.

Postby tonkatruck » Thu Dec 06, 2001 8:19 am

Hello

I am trying to make it so my users could go to
http://www2.somedomain.com/firstname.lastname

and would be redirected to

http://www.somedomain.com/mypage.phtml? ... l=lastname

I've written the following, but suck at regex and am only getting a 500 Error.

RewriteEngine on
RewriteRule ^/([a-z]*).([a-z]*] http://www.somedomain.com/mypage.phtml?firstname
=$1&lastname=$2 [R]

It's in the .htaccess file in the root of www2.somedomain.com
tonkatruck
 
Posts: 2
Joined: Wed Dec 05, 2001 4:00 pm

Postby Brett » Fri Dec 07, 2001 6:36 pm

Try this:

RewriteEngine on
RewriteRule ^([a-z]*).([a-z]*) http://www.somedomain.com/mypage.phtml? ... astname=$2 [R]

I made the following changes:
(1) Deleted initial slash
(2) Changed . to . (since . just means "any character")
(3) Changed final square bracket to a right parenthesis

You might also want to use [a-zA-Z] to allow for the possibility of uppercase letters.

<font size=-1>[ This Message was edited by: Brett on 2001-12-07 21:39 ]</font>
Brett
 
Posts: 82
Joined: Tue Jul 10, 2001 4:00 pm
Location: yohost.com

Postby tonkatruck » Mon Dec 10, 2001 12:30 pm

Thanks Brett,

I also was having trouble because I was trying to apply the rule in the .htaccess file and needed to have it in the DIRECTORY block.

-Phil
tonkatruck
 
Posts: 2
Joined: Wed Dec 05, 2001 4:00 pm


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 42 guests

cron