mod_rewrite help - GET request
I'm having trouble w开发者_JS百科ith what should be a simple mod_rewrite. I want to convert the following URL:
http://example.com/c/c0001
to
http://example.com/c/index.html?c=c0001
I've tried for the life of me and cannot get the rewrite to work. I know htaccess is being read as my trial attempts are yielding different results, but nothing to get the result I want. Some examples of what I've tried:
Options +FollowSymlinks
RewriteEngine on
#RewriteRule (.*) index.html?c=$1 [L]
#RewriteRule ^([^/\.]+)$ index.html?c=$1
RewriteRule ([^/\.]+) index.html?c=$1 [L]
and many other iterations. Can anyone help? Thanks!
Try the following:
RewriteEngine on
RewriteRule c/(.+) index.html?c=$1 [L]
I would encourage you to be more specific though, for example if c
is always in the format c####
and optionally allowing for the trailing slash.
RewriteEngine on
RewriteRule c/(c\d+)/? index.html?c=$1 [L]
精彩评论