•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Linux Servers and Apache section within the Tech Talk category of DaniWeb, a massive community of 426,811 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,926 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Linux Servers and Apache advertiser: Programming Forums
Views: 618 | Replies: 1
![]() |
•
•
Join Date: May 2008
Posts: 32
Reputation:
Rep Power: 1
Solved Threads: 2
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
What room is there in this world for a 15 year old PHP developer :(
•
•
Join Date: Sep 2008
Location: Downham Market, UK
Posts: 8
Reputation:
Rep Power: 0
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.
Try 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
![]() |
•
•
•
•
•
•
•
•
DaniWeb Linux Servers and Apache Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
Other Threads in the Linux Servers and Apache Forum
- Previous Thread: URL masking
- Next Thread: Silent Installation of ApacheDS and Directory Studio


Linear Mode