I've been stuck on this for a few days now and no search has helped me. I'm sure there's a really simple solution, but at the minute I can't seem to find it! I hope you guys can help.
On one of my sites I have an .htaccess file that redirects to pretty URLs (for placing in an email). This works fine:
- Code: Select all
Options +FollowSymLinks
RewriteEngine On
Options -Multiviews
RewriteRule ^blah/([a-zA-Z0-9+-]+)/([a-zA-Z0-9+-]+)(/)?$ /blah.php?company=$1&key=$2 [NC]
RewriteRule ^blah/([a-zA-Z0-9+-]+)(/)?$ /blah.php?company=$1 [NC]
RewriteRule ^blah(/)?$ /blah.php [NC]
However, we've decided to make the whole site work on https (as it holds personal information and users can login from any page) and I've added some code to the .htaccess for this. The whole .htaccess file now looks like:
- Code: Select all
Options +FollowSymLinks
RewriteEngine On
Options -Multiviews
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
RewriteRule ^blah/([a-zA-Z0-9+-]+)/([a-zA-Z0-9+-]+)(/)?$ /blah.php?company=$1&key=$2 [NC]
RewriteRule ^blah/([a-zA-Z0-9+-]+)(/)?$ /blah.php?company=$1 [NC]
RewriteRule ^blah(/)?$ /blah.php [NC]
Whilst the site is correctly redirecting to the secure pages, the $_GET variables aren't being passed through to blah.php (the rewritten URL). Although if I echo $_SERVER['REQUEST_URI'] from the blah.php page, it displays correctly - the values that I entered (e.g. /blah/companyname)
Am I doing something really stupid? I'd really appreciate your help guys.. really stumped on this one!
Thanks in advance,
Kev