I tried it but it still doesn’t work… thanksf or the alternative though cpradio, I’ll keep playing around with it. If anyone has any other suggestions I’m all ears (eyes).
Your code, though, is illogical as you’re requiring the {REQUEST_URI} string to be both forumdisplay.php and null.
Your second attempt isn’t much better as the first RewriteCond is merely repeating the RewriteRule’s match (why bother?), the second RewriteCond will also match a query string of “off=63000” (you were correct on your first attempt) and you should really use the start and end anchors of your first attempt’s RewriteCond in the RewriteRule’s test for ^forumdisplay\.php$.
Despite all that, at least you got to code which was somewhat usable so you must be given kudos for that. :tup:
Both CP’s,
It appears that you need a bit of a refresher on both regex and mod_rewrite. Therefore, you might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.
I should note, that I had to replace R=301 with NC, because it kept putting the document path into the redirect URL (so maybe you have to use the entire url when using R=301?)
If that is the case, you would need to use:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^f=63$
RewriteRule ^/forumdisplay\\.php$ http://mydomain.com/forum/forumdisplay.php?f=1 [L,R=301]
crumblepie, keep in mind, if you use NC it may or may not register the redirect with search engines (not sure how important that is to you).
If you do want it to register the redirect with search engines, you can use the following (I did get it to work locally so long as I used the full domain path):
RewriteEngine On
RewriteCond %{QUERY_STRING} ^f=63$
RewriteRule ^forumdisplay\\.php$ http://your-domain-here.com/folders-to-forum-file-here/forumdisplay.php?f=1 [L,R=301]
Actually, using NC is fine. Sorry, my statement was not fully stated properly. Because we didn’t have R=301, that was likely not good for Search Engines (as it designates a permanent redirect). You should be able to add the NC back into the brackets like so [NC,L,R=301]
The reason it didn’t work is that you’re using an Apache 2.x server, not Apache 1.x. Remove the / from the RewriteRule and you’ll be okay.
dio,
NO! The No Case flag is designed to be used on case INsensitive variables like {HTTP_HOST}. Okay, WinDoze is not case sensitive but Linux servers are so get used to creating exact links. As a general rule, NEVER use the No Case flag on a {REQUEST_URI} variable (i.e., RewriteRule statements).
Still wrong for the reason above for the No Case flag (see, you removed the leading /) but you don’t have the redirected URI displayed because you removed the R=301 flag (which tells browsers/SEs that the redirection is permanent) and will force the display of the redirected URI.
Sorry, dio, NC does not do anything with SEs. It simply makes the case of letters relevant (default) or not.
Yes, by using a WinDoze server. Okay, okay, mod_speling will correct one or two typos and capitalization problems … but host generally don’t have mod_speling enabled. As above, learn to use ONE CASE (lower is almost universally preferred) and make your links correct.
Wrong again. NC is NOT fine (as explained above). dio did pick-up the R=301 flag, though.