I need a help here with .htaccess regular expressions. I want to forward this url: www.aloha.com/foo/bar/sample.html to www/aloha/foo/bar/index.php?go=sample.
I tried to use
RewriteRule /foo/bar/^(.*)?.html /foo/bar/index.php?go=$1 [L]
but it doesn’t work.
I also already have another rewrite rule that clash with this rule. That’s why I need to create another rule for this specific folder.
RewriteRule ^(.*)?.html index.php?input=$1 [L]
Some of your syntax was out of place. For example, the
^denotes the beginning or a negation of a character class. Also, I’m assuming you want a file name, so don’t use the optional capture?.Finally, I made the capture non-greedy. I’d encourage you to take this a step further and be more specific with your capture.
For example: