Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-16-2011, 08:31 PM   PM User | #1
xeirus
New Coder

 
Join Date: Aug 2008
Posts: 66
Thanks: 23
Thanked 0 Times in 0 Posts
xeirus is an unknown quantity at this point
Exclamation .htaccess / URL Re-Write / PHP

Hi!
I have this line in my .htaccess file which makes a .php file look like a .html

rewriterule ^contact_us-([^-]+)-([^&]+)\.html$ /contact_us.php?lang=$1&cur=$2&page=$3&url=$4 [L]

And this page also has a form, which submits to this page itself as:
contact_us-lang-english-cur-us-page-1-url-emailus.html?do=checkinput

But it doesn't work ...

Please help!

- Xeirus
xeirus is offline   Reply With Quote
Old 10-16-2011, 08:33 PM   PM User | #2
DJCMBear
Senior Coder

 
DJCMBear's Avatar
 
Join Date: Mar 2010
Location: United Kindom
Posts: 1,173
Thanks: 14
Thanked 136 Times in 136 Posts
DJCMBear is on a distinguished road
At the end of that line you need [QSA,L] as the QSA combines the old and new query strings in the rewrite.
__________________
Official BinPress hand picked coder.
For anyone worried about SQL injection go have a look at my small yet powerful script here.
Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
I am 1 of 65,608 people to get a Pebble Watch :P
DJCMBear is offline   Reply With Quote
Users who have thanked DJCMBear for this post:
xeirus (10-16-2011)
Old 10-16-2011, 08:46 PM   PM User | #3
xeirus
New Coder

 
Join Date: Aug 2008
Posts: 66
Thanks: 23
Thanked 0 Times in 0 Posts
xeirus is an unknown quantity at this point
Quote:
Originally Posted by DJCMBear View Post
At the end of that line you need [QSA,L] as the QSA combines the old and new query strings in the rewrite.
Thank you very much DJCMBear!
That worked like a charm !

Thanks indeed

- Xeirus
xeirus is offline   Reply With Quote
Old 10-16-2011, 08:48 PM   PM User | #4
DJCMBear
Senior Coder

 
DJCMBear's Avatar
 
Join Date: Mar 2010
Location: United Kindom
Posts: 1,173
Thanks: 14
Thanked 136 Times in 136 Posts
DJCMBear is on a distinguished road
Not a problem, I am glad I could help
__________________
Official BinPress hand picked coder.
For anyone worried about SQL injection go have a look at my small yet powerful script here.
Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
I am 1 of 65,608 people to get a Pebble Watch :P
DJCMBear is offline   Reply With Quote
Reply

Bookmarks

Tags
htaccess, php, re-write, rewrite, url

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:56 PM.


Advertisement
Log in to turn off these ads.