The only thing that is important here is the old “cat_id”, which is now “aid”, the number is the same (750 in this case) but since we’re now using 4 digits, there needs to be an extra 0 for this, which I added. However, I can’t get it to work…
I’ve placed this in the root (/) of my site.
The old script had 2 different pages, a details page and a categories page, both had the cat_id. The image_id from the details.php can be ignored, this can be redirected to the new album.php with the “aid”.
Can anyone spot my fault(s) ?
RewriteEngine On
Options +FollowSymLinks
Redirect ^photos/categories\\.php\\?cat_id=([0-9]+)$ http://www.mysite.com/album.php?yr=2009&aid=0$1
Back to the tutorial, my friend! I don’t believe Redirect(Match) can examine the query string just like a RewriteRule can’t (it can only attempt to match the {REQUEST_URI} string). THEREFORE, you MUST use RewriteCond to examine (and capture) from the query string for your redirects.
If you can’t get the answer you need from those hints, come back and I’ll lead you through it (I don’t code for free but am willing to spend the time to help members LEARN about mod_rewrite).
I don’t understand your use of the !marker test. What’s that for?
No matter, it shouldn’t play a part (unless ‘marker’ is in your query string).
THEN, what’s with trying to redirect album.php to the value of aid? that will NOT work (unless aid is a filename in your DocumentRoot)!
FINALLY, you fall back on trying to test/capture a value in a query string using a RewriteRule. That will NEVER work (as explained above, a RewriteRule can ONLY examine the {REQUEST_URI} string which, by definition, does NOT include the {QUERY_STRING}). You have the correct approach in your RewriteCond statements in the first mod_rewrite block; why did you abandon that? Do the same thing in the second mod_rewrite block BUT do not use the full absolute URL, only the URI (or the redirection will be displayed - if you WANT it displayed, use R=301 so SEs know it’s a permanent redirection).