Hi, I just need help writing the correct mod_rewrite rule to transform my script-generated URL's to the actual pages I wish to use: http://www.domain.com/index.php?a=page&id=word to http://www.domain.com/word.htm best would be rule which could deal with either .htm or .html, as I actually need to transform pages to both, but I'll settle for the first. Here's a rule that isn't doing anything. Can anyone tell me what might be wrong with this? RewriteEngine On RewriteBase / Options +FollowSymlinks RewriteRule ^([^/]*)\.html$/index.php?a=page&id=$1 [L]
Options +FollowSymLinks +Indexes RewriteEngine on RewriteRule ^([^.]+)\.html$ index.php?a=page&id=$1 [L] Only if you want search engines seeing duplicate content should you use both .htm and .html.
What I mean is, I have some pages (early ones) that are .htm, started using .html later, so some pages would .htm. I also have to figure out how transform for directory URLs. Thanks for the rule...I'll see if it does the trick. It did not: it gave me: The requested URL /karmaalliancelightinstitute.com/w0712/d37/s14/b0286d91/www/karmaalliancelightinstitute.com/index.php was not found on this server. It's really strange...all the rules I try do the opposite of what I want-if they work at all.
whats your full base dir to the www folder ? some hosts have a very wacky modrewrite implementation knowing your base dir will help.
er, yah!! That might help!!!! Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^([^.]+)\.html$ index.php?a=page&id=$1 [L]
Thanks Nintendo-the rule works with RewriteBase / Must always remember that when doing .htaccess. Now the problem is that this works too well-rewrites all .html addies. Maybe I'll use all those pages with the script and make new pages with wordpress permalinks to get rid of the extension. I also need one-to-one rule that will rewrite specific subdirectories (i.e. domain.com/title/ as I have some pages like that that also need to change. Is is a bad idea to write one-to-one RewriteRules for each page and have 30-40 rules in my .htaccess? In that case, I guess I just replace the parenthesis with the page title. I'll return to the thread with any problems I run into.