0

Hi,

I have used mod_rewrite quite a bit so I am surprised I cannot get this to work. I think the issue may be with the ? in the url but not sure.

Background:
LAMP server, php/Mysql site with mod_rewrite set up and working correctly. The main rewrite rule is this:

RewriteRule ^([^\.]+)$ /page.php?page=$1 [L]

The reason is that the client wants to have pages with no extension like .php. This works fine as the suffix is added once the php page receives the $_GET variable.

Problem:
The client uses various links to the site for marketing and now wants to use certain pages as landing pages. These pages need 6 GET vars so I have the rule:

RewriteRule ^([a-zA-Z-]+)\?a=/([0-9]+)&b=([0-9]+)&c=([0-9]+)&d=([0-9]+)&e=([0-9]+)$ /page.php?page=$1&a=$2&b=$3&c=$4&d=$5&e=$6 [L]

which I put above the main rule for these landing pages but it is only passing the first var to the page.php page. The first is the page name followed by a to e. I have tried combinations but just can't get it to work. I think it is to do with the escaped ? or am I looking in the wrong place?

There may be a better way to get the page name as the first var and then the other vars passed to the php page. The page names are dynamic or I would just use them by name which would be much easier, but there are several thousand.

Any help or pointers to tutorials will be much appreciated. I have read so many in the last 2 days but I know the answer is somewhere.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by twiss
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.