GET variables in PHP - rewrite?

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 2
Joined: 10 May 2012, 10:00

GET variables in PHP - rewrite?

10 May 2012, 10:18

Hi,

I wonder if anyone can help.

We have a WordPress site and have got rewrites working to a point, hosted on iis6 with isapi_rewrite 3.0 lite.

The developers have a version of our site and all their rewrites work flawlessly but that is hosted on a linux server.

The problem we have is below:

http://blackburn.labpad.co.uk/course/business-administration-and-enterprise-level-1/?section=student-work-examples This is the developers version on the linux server and takes you the student work examples section within that particular course

http://www.blackburn.ac.uk/course/business-administration-and-enterprise-level-1/?section=student-work-examples This is the current live version of the site and if will never show you the student work examples, even if you remove the ?section=xxxxxx from the urls. It will only ever show you the current page. Clicking on the section link on the side won't even bring it up

The rewrite on the linux server is:

Code: Select all
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blackburn.ac.uk/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blackburn.ac.uk/index.php [L]
</IfModule>


The rewrite on the live server is:

Code: Select all
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/wp-admin
RewriteRule ^(.*)$ index.php?p=$1 [NC,L]


We have gone back to our developers but they have just come back with : " I am unsure as to why the GET variables in PHP wouldn't be getting picked up in the URL on a Windows server"

If anyone can please assist we would be most grateful

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: GET variables in PHP - rewrite?

10 May 2012, 11:40

Hello,

Lets try using the following:

Code: Select all
Rewriteengine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/wp-admin
RewriteRule ^(.*)$ index.php?p=$1 [QSA,NC,L]


This rule means that the resulting request would be: course/business-administration-and-enterprise-level-1/index.php?p=section=student-work-examples. IS it what you're looking for? I tested it, but didn't get results. QSA flag allows to append querystring.

Regards
Andrew

User avatar
Posts: 2
Joined: 10 May 2012, 10:00

Re: GET variables in PHP - rewrite?

10 May 2012, 16:26

Fantastic, that now works perfectly on our windows server

thanks for your speedy response!

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 2 guests