开发者

.htaccess rewrite error on POST

I have a Drupal site installed in a subfolder "blog/".

It was in the root months ago, so I had to create a rewrite rule to redirect old url to the new path.

This works fine, except that it doesn't work for node edit. When I update a content (POST method), I always get 404 page on the main site (the one in the root folder).

These are my rules in the root .htaccess

RewriteRule ^content/(.*)$ http://www\.mysite\.com/blog/content/$1 [R=301,L]
RewriteRule ^page/(.*)$ http://www\.mysite\.com/blog/page/$1 [R=301,L]
RewriteRule ^sites/(.*)$ http://www\.mysite\.com/blog/sites/$1 [R=301,L]
RewriteRule ^node/(.*)$ http://www\.mysite\.com/blog/node/$1 [R=301,L]
RewriteRule ^blo开发者_Go百科g/(.*)$ http://www\.mysite\.com/blog/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^mysite\.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301]

and these are the ones in the subfolder .htaccess

RewriteCond %{HTTP_HOST} ^mysite\.com$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]

I don't think is something related to Drupal itself, but it's something wrong in the RewriteRule.

Can someone give me an advice?


By using full http:// URLs and R=301, you are telling the server to send redirect headers to the browser instead of doing an internal rewrite. POST variables will not be re-sent to the new location.

If you want POST variables to get through, you need to do internal rewrites (assuming that the rewrite target is on the same server as your .htaccess file). Those won't change the URL in the browser bar, though - not sure whether that is what you want.

RewriteRule ^page/(.*)$ /blog/page/$1 [QSA,L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜