Please help a newbie who is rapidly losing the will trying to figure out a redirect instruction to go in my htaccess file.
My site has lots of dynamically-generated pages with SEO-friendly urls. On page request, I want to direct the request to two handling scripts, depending upon the URL called. These process and generate the page requested. These are not permanent 301 url changes or anything – purely an redirect to specific handling scripts.
Typical urls will be…
[
mydomain.com...]
[
mydomain.com...]
Page addresses without a number in the name are handled by /scripts/handler1.php?N= + the parameter ‘apples.htm’. Pages that contain a number are handled by handler2.php with the additional parameter of P= the number contained in the URL. So, these two demo addresses should be handed over to …
/scripts/handler1.php?N=apples
/scripts/hander2.php?N=pears&P=1
I haven’t got as far as trying to figure out how to split between the two scripts because I can’t even get the basic redirect to handler1.php to work. I’m testing on a Windows /Wampserver machine which possibly works a little differently to the live server, which in LAMP. However, I had assumed that the following would work – but it doesn’t…
RewriteRule ^fruit/([a-zA-Z0-9\_\.\&-°]*).([a-zA-Z0-9\_\.\&-°]*)$ /scripts/handler.php? N=$1 [L]
Any help to put me on the right road will be much appreciated.