I'd like to rewrite my site url of below two patterns (note: there are a lot such urls that i hope to use one rule to rewrite them all)
www.hetaoblog.com/hello
www.hetaoblog.com/hello/
to
**www.hetaoblog.com/myblogs/post/hello.jhtml**
all other cases like http://www.hetaoblog.com/
should not be changed;
I've tried
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /index.php [L]
RewriteRule ^([^/]+)/$ /myblogs/post/$1.jhtml [L]
RewriteRule ^(.*)$ /myblogs/post/$1.jhtml [L]
</IfModule>
and
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /index.php [L]
RewriteRule ^(.+)/$ /myblogs/post/$1.jhtml [L]
RewriteRule ^(.*)$ /myblogs/post/$1.jhtml [L]
</IfModule>
and
RewriteRule ^([^/]+)+/$ /myblogs/post/$1.jhtml [L]
however, they work for my wanted two cases but they will both rewrite
www.hetaoblog.com/
to
www.hetaoblog.com/myblogs/post/.jhtml
It looks the + sign which should mean at least one occurrence is not happening.
www.hetaoblog.com/hello.jhtml
, but your rules are pointing to/myblogs/post/$1.jhtml
? Are you looking to redirect the client, or transparently serve content from the other location?