Welcome to WebmasterWorld Guest from 188.8.131.52
This is what I have:
rewriteRule ^pages/(.*)$ /index.cgi?page=$1 [T=application/x-httpd-cgi,L]
rewriteRule ^hostingplan/(.*)$ /index.cgi?page=$1 [T=application/x-httpd-cgi,L]
my pages are located at:
End result should look like this:
From researching this forum, I was able to come up with the above rules. I have a few questions, if someone could help I would be grateful.
1. Does my code look okay? Do I need to change anything?
2. I am not sure exactly what the [T=application/x-httpd-cgi,L] means. If someone could explain, I would appreciate it. Do I need to use it?
3. I have tried to redirect my old links to the above new links using Redirect Permanent. But it wouldn't work. Any suggestions?
Thanks in advance for any help. I appreciate the advice.
Looks OK to me. You can test this by modifying one of the old "page names" and then trying to access that "page name" directly using your browser. For example, add
RewriteRule ^testpages/(.*)$ /index.cgi?page=$1 [T=application/x-httpd-cgi,L]
The flags T and L specify a mime-type for the script you are redirecting to, and specify that all mod_rewrite processing should end if the RewriteRule matches and is processed, respectively.
I'm not sure that the T part is really needed, but you could try testing it both ways.
For details on mod_rewrite, see the Apache mod_rewrite documentation linked from this Introduction to mod_rewrite [webmasterworld.com] post.
RewriteRule ^(.*)_section$ /section.php?section=$1
RewriteRule ^veil_edges/(.*)$ /veil_edges.php?edge=$1
RewriteRule ^(.*)showpres_(.*)\.php$ /presentations/pres.php?pres_id=$2
RewriteRule ^(.*)_section/(.*)_shop\.php$ /shop.php?shop=$2§ion=$1
RewriteRule ^(.*)_section/show_(.*)\.php$ /show.php?show=$2§ion=$1 [L]
Yes, probably. Usually, the only time you don't want [L] is if you want the results of a given matched RewriteRule passed on to the RewriteRules that follow it for further rewriting.
Basically, without [L] the rewrite engine keeps going and tries to match all the remaining rules in your .htaccess/httpd.conf file, so yes, that can be very inefficient. Use [L] whenever you intend that the rewrite take place and the new URL be used to serve a file immediately, with no more rewriting needed. (Note also that the [F] and [G] flags never need an accompanying [L] since they immediately terminate rewriting.)