| | |
URL Rewriting pass query string
![]() |
•
•
Join Date: May 2008
Posts: 223
Reputation:
Solved Threads: 18
Hi,
I have set up a URL rewriting rule for my website:
Which works fine if I request a page like
http://mysite.com/folder/something.html
it would show
http://mysite.com/main.php?Area=folder&Page=something
but I want to also be able to pass the rest of the query string so something like
http://mysite.com/folder/something.html?Bob=Jim
would pass the query string onto the main.php page like
http://mysite.com/main.php?Area=fold...ething&Bob=Jim
Is there a way to do this.
Regards,
Sam Rudge
I have set up a URL rewriting rule for my website:
RewriteRule ^([A-Za-z]+)/([A-Za-z]+)\.html$ /main.php?Area=$1&Page=$2
http://mysite.com/folder/something.html
it would show
http://mysite.com/main.php?Area=folder&Page=something
but I want to also be able to pass the rest of the query string so something like
http://mysite.com/folder/something.html?Bob=Jim
would pass the query string onto the main.php page like
http://mysite.com/main.php?Area=fold...ething&Bob=Jim
Is there a way to do this.
Regards,
Sam Rudge
My Blog, Life and everything that matters to me - SamRudge.co.uk
•
•
Join Date: Sep 2008
Posts: 8
Reputation:
Solved Threads: 1
Hi Sam,
Try this:
Or this (the PT in the example above will make the viewer only see /some/url.html - and NOT /main.php?Area=x&Page=y - if you want the viewer to see/main.php etc remove the PT):
You can find more information here: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
Adnan
•
•
•
•
Hi,
I have set up a URL rewriting rule for my website:
Which works fine if I request a page likeRewriteRule ^([A-Za-z]+)/([A-Za-z]+)\.html$ /main.php?Area=$1&Page=$2
http://mysite.com/folder/something.html
it would show
http://mysite.com/main.php?Area=folder&Page=something
but I want to also be able to pass the rest of the query string so something like
http://mysite.com/folder/something.html?Bob=Jim
would pass the query string onto the main.php page like
http://mysite.com/main.php?Area=fold...ething&Bob=Jim
Is there a way to do this.
RewriteRule ^([A-Za-z]+)/([A-Za-z]+)\.html$ /main.php?Area=$1&Page=$2 [PT,QSA]
RewriteRule ^([A-Za-z]+)/([A-Za-z]+)\.html$ /main.php?Area=$1&Page=$2 [QSA]
Adnan
![]() |
Similar Threads
Other Threads in the Linux Servers and Apache Forum
- Previous Thread: Dude, I'm Wantin' a Dell
- Next Thread: Silent Installation of ApacheDS and Directory Studio
| Thread Tools | Search this Thread |
.net apache asus bbc bluegene centos cisco citrix cloud cloudcomputing datacenters debian dell desktops development distributions distros drivers economy eeepc energy enterprise fedora gadgets gentoo gos government gpl hardware hp hyper-v ibm java jobs kindle knoppix kvm laptop laptops lawsuits licensing limo linustorvalds linux linuxfoundation linuxmagazine magazines microserver microsoft mobile mobilephones motorola netbook netbooks news novell olpc open openmoko openoffice opensolaris opensource opensuse openvz operatingsystems os patents pc pcworld plathome politics print qumranet redhat rhel robot russia sco server servers slackware software solaris source sun supercomputer support tivo torvalds training tv ubuntu umpc unix virtualization vmware windows x86 xandros xen





