Connecting Tech Pros Worldwide Forums | Help | Site Map

Mod rewrite question

Kelicula's Avatar
Expert
 
Join Date: Jul 2007
Posts: 169
#1: Apr 11 '09
I am trying to make the url change, and STAY that way.

I would like to change url's of this type:

[code]http://www.domain.com/someword/somenumber[/codel]

into...

Expand|Select|Wrap|Line Numbers
  1. http://www.domain.com/cgi-bin/someword.cgi?id=somenumber
I have that working, but what if I want the url in the address bar to change to:
Expand|Select|Wrap|Line Numbers
  1. http://www.domain.com/someword/somenumber
AND STAY THAT WAY, while actually routing me to:
Expand|Select|Wrap|Line Numbers
  1. http://www.domain.com/cgi-bin/someword.cgi?id=somenumber
Is this possible?
Is mod_rewrite what I need?
Or something else.

I have seen many sites that use Perl, that DO NOT have the cgi-bin/script.cgi format on their pages.

How do they do it?

Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,949
#2: Apr 12 '09

re: Mod rewrite question


Yes it is possible using rewriting.

Check out some of these results.
Kelicula's Avatar
Expert
 
Join Date: Jul 2007
Posts: 169
#3: Apr 12 '09

re: Mod rewrite question


Alright man, thanks!!

I just had to remove the "R". For some reason I had the R=301 modifier.
So it would re route you to correct script, but it would change the url in browser too. Without the R, it leaves the url entered untouched.

Works great now!!
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,949
#4: Apr 12 '09

re: Mod rewrite question


Quote:

Originally Posted by Kelicula View Post

Alright man, thanks!!

I just had to remove the "R". For some reason I had the R=301 modifier.
So it would re route you to correct script, but it would change the url in browser too. Without the R, it leaves the url entered untouched.

Works great now!!

Yep, the R forces a Redirect.

Glad you got it working,

- mark.
Reply


Similar Apache Web Server bytes