Hi. I need some help with creating search engine friendly URLs. I know there is a lot of documentation but I am new to .htaccess and I just cannot wrap my head around it beyond the basics. I want to create different rules for different pages:
site.com/index.php?p=XX to site.com/XX AND site.com/XX/
site.com/browse.php to site.com/browse AND site.com/browse/
site.com/browse.php?cat=XXX to site.com/browse/XXX and site.com/browse/XXX/
site.com/profile.php?user=XX to site.com/user/XX and site.com/user/XX/
site.com/view.php to site.com/view and site.com/view/
the reason why I want the it to operate on both trailing slash and without is that people might sometimes enter the URL differently.
finally, does anyone know the best way to rewrite a search query URL, seeing I have both a simple search (1 field) and an advanced search (multiple fields). How would the variables be fed into the URL?
Thanks so much!
04-28-2012, 03:32 PM
If you want when you write site.com/XX to execute site.com/index.php?p=XX
RewriteRule ^\/browse(\/)?$ /browse.php [NC]
RewriteRule ^\/browse/(.*)(\/)?$ /browse.php?cat=$1 [NC]
# And so on for the rest. The index can use this one
RewriteRule ^\/(.*)$ /index.php?p=$1 [NC]