Just moved to shared hosting on GoDaddy and Im trying to get my .htaccess rules working.
Heres what I have:
ErrorDocument 404 /error.php
Options FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.mydomain\.org$
RewriteRule ^(.*)$ http://mydomain.org/$1 [R=301,L]
RewriteRule ^view/(\w+)$ viewitem.php?itemid=$1 [R=301,L]
RewriteRule ^category/(\w+)$ viewcategory.php?tag=$1 [R=301,L]
RewriteRule ^faq$ faq.php
RewriteRule ^about$ about.php
RewriteRule ^contact$ contact.php
RewriteRule ^submit$ submit.php
RewriteRule ^contactmsg$ handler-contact.php
All the pages @ the root of the domain seem to be working i.e mydomain.org/faq, mydomain.org/about are working.
But whenever I try mydomain.org/category/somecategory, I get a 404. How can I fix my .htaccess to obey these rules that are more than 1 level deep?
Thanks,
EDIT: I have fixed the rules by changing them to the following:
RewriteRule ^view/(.*)$ viewitem.php?itemid=$1
RewriteRule ^category/(.*)$ viewcategory.php?tag=$1
Can anyone confirm/deny that this is the proper way to fix this?
The new way you're doing it (with
(.*)
) is correct.