rodenbushdesign
rodenbushdesign

Reputation: 81

.htaccess mod_rewrite just broke the site

in the following .htaccess file...


RewriteEngine on
RewriteCond %{HTTP_HOST} ^getpearson.com$
RewriteRule ^/?$ "http\:\/\/www\.getpearson\.com" [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^redesign_03012010/mock-up/([^/]+)/([^/]+)$ /redesign_03012010/mock-up/index.php?page=$1§ion=$2 [PT]
RewriteRule ^redesign_03012010/mock-up/([^/]+)$ /redesign_03012010/mock-up/index.php?page=$1 [PT]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)$ /index.php?test=1&page=$1§ion=$2
RewriteRule ^([^/]+)$ /index.php?test=1&page=$1 [L]

i removed modified the last 3 lines from:


RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)$ /index.php?test=1&page=$1§ion=$2
RewriteRule ^([^/]+)$ /index.php?test=1&page=$1 [L]

to:


RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)$ /index.php?page=$1§ion=$2
RewriteRule ^([^/]+)$ /index.php?page=$1 [L]

...hence only removing the 'test=1&' url variable, and now it no werkie... what is the logic to this crazy htaccess lingo? it stumps me. anyhow, i did a php work-around until i can figure this out, so no worries, but please help! thanks!

Upvotes: 0

Views: 177

Answers (3)

ceejayoz
ceejayoz

Reputation: 180105

Sounds like a problem in your index.php file, not .htaccess. What happens when you access index.php without test=1 directly instead of via the rewritten URL? I suspect it's configured to throw a 500 error in that situation.

Upvotes: 0

Eric Petroelje
Eric Petroelje

Reputation: 60518

"no werkie" is a little vague... The edit you made to the rules seems fine. Maybe the index.php page is expecting the "test" variable to be present and will crash if it isn't?

Instead of removing the "test" variable from the query string, try just changing "test=1" to "test=0" instead.

Upvotes: 2

Ceilingfish
Ceilingfish

Reputation: 5455

Lucas, I think you're last two rules are missing a / before the pattern. And also take out [PT] it's not appropriate in this case.

RewriteRule ^/([^/]+)/([^/]+)$ /index.php?test=1&page=$1&section=$2
RewriteRule ^/([^/]+)$ /index.php?test=1&page=$1 [L]

Tom

Upvotes: 0

Related Questions