rooftop — 2012-10-11T05:28:20-04:00 — #1
I have a website with the following url rewrite set
RewriteRule ^Cat-(.*)-(.*).html$ section.php?cat_name=$1&cat=$2
I'd like to change the URLs from
I can change the rewrite rule to
RewriteRule ^L1-(.*)-(.*).html$ section.php?cat_name=$1&cat=$2
But is there a way I can redirect any pages listed in search engines so that
dklynn — 2012-10-11T18:34:47-04:00 — #2
Yes, that's a simple replacement redirection. See the sample code in my signature's tutorial.
rooftop — 2012-10-12T05:12:41-04:00 — #3
rooftop — 2012-11-14T12:00:52-05:00 — #4
I did have it. But I have returned a few weeks later to admire my break through and I can find no evidence of the work I did.
What a bad trip!
I think I did something like this but it isn't right.
RewriteRule ^L1-(.)-(.).html$ Cat-$1-$2.html [N,L]
Anybody help me?
dklynn — 2012-11-14T23:19:56-05:00 — #5
Based on your sample characters (lowercase for $1 and digits for $2), I'd use:
RewriteRule ^L1-([a-z]+)-([0-9]+)\\.html$ section.php?cat_name=$1&cat=$2 [L]
When you are in a position to specify the characters used in your links, use them in the mod_rewrite code, too. It may be a small security issue to you but it would make hacking much easier for someone trying to break into your website. Besides, the inappropriate use of the :kaioken: EVERYTHING :kaioken: atom is the first indication that the coder has no idea what he/she is doing (and generally results in looping code).
rooftop — 2012-11-15T05:21:31-05:00 — #6
I appreciate the heads up on the security gap. But $1 is a often a mix of Uppercase and lower case so would that make
As important as the security issue is your suggestion doesn't work for the redirect I need.
For example I need:
to go to
I.E. the 'Cat' in the old domain becomes a 'L1' in the new domain.
Thanks for getting back so promptly