I am having a problem with passing 2 values through my URL and I think it’s something to do with my .htaccess file.
When any internal link on my site is clicked, I pass a $_GET variable and depending on that value, display the relative page.
I have an ‘Offers’ page containing 3 offers. There is a link for each offer and the idea is to populate my textarea on my contact page with the value of the offer, should they be linked to my contact page via the Offers page.
Trouble is, my .htaccess file I believe only deals with the instance of 1 $_GET value being passed, but anymore and it doesn’t work.
My is here:
RewriteEngine on
RewriteBase /
RewriteRule ^/?([a-zA-Z_]+)$ index.php?page=$1 [L]
How can I accommodate multiple values being passed?
I’ve nearly got it working and the page loads, but for some reason the stylesheet is not being applied. Although when I look through developer tools, it is loaded in the <head>. No elements have any style whatsoever.
The problem you’re having is simply the change of directory level of the incoming request. When you redirect with multiple “entry” request directory levels, you either need the <base> tag or absolute URIs for your support pages. More in my signature’s tutorial.
As an aside, I’d recommend that you determine the Apache version you’re using to get rid of the optional /'s and your RewriteBase / is doing nothing (useful) do I’d think that should be deleted, too.
You’re rewriting most every URL to index.php, which means your CSS request is likely being rewritten as well. The simplest fix would be to exclude any real file from being rewritten.