1
votes

My webhost recently upgraded their PHP to a new version, and now one of my redirects no longer works.

The redirect that doesn't work now is:

RewriteRule toppers/i-(.*)/n-(.*).html$ toppers.php?i=$1&n=2

Which I find strange because all my other, similar rules still work.

Here is my full .htaccess file:

Options +FollowSymLinks
RewriteEngine on

RewriteRule toppers/i-(.*)/n-(.*).html$ toppers.php?i=$1&n=2
RewriteRule classes/i-(.*)/n-(.*).html$ classes.php?i=$1&n=2
RewriteRule news/i-(.*)/n-(.*)\.html$ news.php?i=$1&n=2

RedirectMatch 301 ^/cake-topper-pictures-pages/(.*) http://www.caketopper.co.uk/wedding-toppers.php
RedirectMatch 301 ^/cake-topper-picture-pages/(.*) http://www.caketopper.co.uk/wedding-toppers.php
RedirectMatch 301 ^/Cake-Topper-Pictures-Pages/(.*) http://www.caketopper.co.uk/wedding-toppers.php
RedirectMatch 301 ^/feedback-topper-pages/(.*) http://www.caketopper.co.uk/toppers/i-1/n-Couple-on-red-dragon.html
RedirectMatch 301 ^/feedback-toppers/(.*) http://www.caketopper.co.uk/toppers/i-1/n-Couple-on-red-dragon.html

ErrorDocument 404 /404.html

What could be wrong and how can I fix it?


To varify that it isn't the PHP file, I have tried:

echo $topperId = $_GET['i'];
echo $topperName = $_GET['n'];

And I get nothing echoed out from the URL.


Options +FollowSymLinks RewriteEngine on

RewriteCond %{REQUEST_URI} toppers/i-(.)/n-(.).html [NC] RewriteRule .* toppers.php?i=%1&n=%2 [L,NC]

RewriteCond %{REQUEST_URI} classes/i-(.)/n-(.).html [NC] RewriteRule .* classes.php?i=%1&n=%2 [L,NC]

RewriteCond %{REQUEST_URI} news/i-(.)/n-(.).html [NC] RewriteRule .* news.php?i=%1&n=%2 [L,NC]

1
Any errors in the error log?jeroen
@jeroen I don't think I have access to it, I don't understand why line 4 wouldn't work if lines 5 and 6 work perfectly?imperium2335
If only php was upgraded, the redirect is probably working but there is an error in the php file.jeroen
You ought to delete or comment out that line and try to add a rewrite rule using your webhost control panel directly. Many times they have an API that does it for you with parameters you give it -- hope this proves useful. GatorHost for example has an interface for it; works every time. If this doesn't work, contact the webhost support linekhaverim
@jeroen please see the edit, I can confirm it's not the PHP file :(imperium2335

1 Answers

0
votes

As @jeroen said it is probably the php. Try replacing the whole file with something like

<?php
die('Got to PHP');
?>

This will find out for sure if you are reaching php. If you have display_errors off and have a parse error or something you could put the code you showed at the top and still get a blank screen.