Forum Moderators: phranque
I've got a url like this:
[example.com...]
how would i edit the .htaccess to make it into:
[example.com...]
I've also got another question, If i have this set up, will google index my pages better? I know with php, google doesnt recognize some of the urls, but will it reconize this?
Thanks a lot for any help you can give me.
- Craig Lichtenberg
Here's my .htaccess:
RewriteEngine On
RewriteRule reviews/([0-9]+) modules.php?module=reviews&id=$1
RewriteRule imports/([0-9]+) modules.php?module=imports&id=$1
RewriteRule versus/([0-9]+) modules.php?module=versus&id=$1
RewriteRule index.html index.php
RewriteCond %{REQUEST_URI} /(reviews¦imports¦content)*
RewriteRule ^(reviews¦news)/images/(.*).(gif¦jpg)$ images/$2.$3
RewriteCond %{REQUEST_URI} /(reviews¦imports¦content)*
RewriteRule ^(reviews¦news)/xtra/(.*).(gif¦jpg)$ xtra/$2.$3
RewriteCond %{REQUEST_URI} /(reviews¦imports¦content)*
RewriteRule ^(reviews¦news)/(.*).(css)$ $2.$3
#After I add the next commands, it doesnt work.
#The image directories are wrong now, and Im not sure
#what to do.
RewriteCond %{REQUEST_URI} v3/SubmitReviews*
RewriteRule SubmitReviews modules.php?module=SubmitReviews
RewriteCond %{REQUEST_URI} v3/reviews*
RewriteRule reviews modules.php?module=reviews
RewriteCond %{REQUEST_URI} reviews*
RewriteRule reviews/(.*) modules.php?module=reviews&id=$1
RewriteCond %{REQUEST_URI} v3/imports*
RewriteRule imports modules.php?module=imports
RewriteCond %{REQUEST_URI} imports*
RewriteRule imports/(.*) modules.php?module=imports&id=$1
anyone =/
Welcome to WebmasterWorld [webmasterworld.com]!
A few comments:
If you do not want mod_rewrite to continue rewriting the URL using all of your rules, use an [L] flag at the end of the RewriteRule line.
If you want to match precise strings, prefixes, or suffixes, anchor your patterns (See regex reference below).
The "*" character has special meaning to mod_rewrite, which uses regular expressions; It means "One or more of the preceding character, group, or parenthesized subpattern."
A review of the Apache RewriteRule documentation [httpd.apache.org] and this Regular Expressions tutorial [etext.lib.virginia.edu] will probably help if you're getting unexpected results.
Jim