Forum Moderators: open
/index.php?pr=Home_Page
or
/index.php?pr=xyz
and when I try to add a redirect then ALL of the index.php pages are redirect to one page.. regardless of their actual page name...
any suggestions?
<?php
header( 'Location: redirect_destination.html' ) ;
?>
That method is easy to implement for a few pages, but if you are working on dozens or hundreds of pages, you should probably go with server mods.
The Condition is redundant; not needed at all.
You need to escape the period on the left of that rule.
Don't escape the colon, slashes or periods in the literal URL on the right.
It doesn't do what the OP needs.
Sure it does do something useful, and is needed in some form on almost every site.
Or is that code from an example somewhere on their site?
As I said, in that example the pattern to be matched needs some characters escaping, and there should not be any escaping added to the literal target URL. That's a syntax error, or seven, in that one example.
Nix/Apache says it's a cPanel problem - I'm guessing that their (cPanel) latest release has been a bit buggier than a windscreen on a sunny summer afternoon these days.
I've gone to writing some of this stuff myself, at least for the ones who want it done;
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^folder/index.php$ http://www.example.com/ [R=301,L]
I'm still waiting to hear back from cPanel.
I'd hate to change. We ran Plesk for a period of time a while back on a few windows boxes and any of our clients that used the cPanel before hated it ... needless to say, Plesk went away.
It's been a bit of a long while since I've taken the plunge on writing these in.
At any rate, the mates over on the cPanel suggested that I take a bot trap or two down, on a few of the effected domains. Cleared up quicker than a bad case of acne.
Still, I've a mind to write most of these types of redirects in by hand just to stay on my game in the future.
Good one on you, and thanks g1smd