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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mod_rewrite 1

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
I am trying to find a tutorial to learn about substituting the contents of a query string. All the tutorials I have seen so far, deal with redirection (which I have got to grips with) and then only give complex examples of the rewrite rule without much of an explanation.

Keith
 
I have the following rule working
Code:
RewriteRule ^(.*)/(.*).html?$ /cgi-bin/script.cgi?page=$1&item=$2 [NC]

invoked by
Code:
[URL unfurl="true"]http://www.mysite.co.uk/mypage.tmpl/mytitle.html[/URL]

but I would like to hide 'mypage.tmpl' in the address bar while still including it in the rewritten URL.
Is this even possible?
I know I could rework the links themselves but I am just curious.

Keith
 
but I would like to hide 'mypage.tmpl' in the address bar while still including it in the rewritten URL.

I think you'd need to that in a combination of RewriteRule, and an Alias in your httpd.conf or apache.conf files.





----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
I have brought this thead back to life to hopefully solve a small issue I have with mod_rewrite.

I am finding mod_rewrite very useful but there are a few restrictions I am discovering. In reality, it is probably the fact that I am only scratching the surface regarding it's capabilities.

I am comfortable with creating links which look pretty and go to the desired URL ie.

Code:
http//mysite.co.uk/ducks/green

takes me to my fine collection of green ducks via a rewrite rule.
Now I am looking at the results of a form, let's take the example of a log in form to examine.

In this log on form we have an action which is set to
Submitting the form directs me to the correct place but to the root so I want to direct it to a specific place so I append some info to the action ie.
This gives us a great redirect to whatever is set to login/user and works well but this is a log in form so that jolly user of our website needs to enter their username and password into the form. The form is simple enough but how to I get the form variables, 'user' and 'pass' into the last two lonely variables in the rewrite rule.
Code:
RewriteRule ^(login)/(user)/(.*)/(.*)?$ /cgi-bin/psycont.cgi?table=members&user=$3&pass=$4 [NC]




Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top