开发者

mod_rewrite Internal rewrite with the new URL showing

I am using Mod_Rewrite to rewrite (internal) some old pages to new pages on my site.

This works:

RewriteRule ^thispage\.html$ thatpage.html 

The problem is that the page changes to the new page (this is good!), but does not change the (URL) name from "thispage" to "thatpage" so the user gets hinted to the new address. Apache (2.x) states to place a [R] after the above script, i.e.,

RewriteRule ^thispage\.html$ thatpage.html [R]

This supposedly lets the user know it is changed and sends them to the new page.

When I add the [R], I get a 500 error. The server is an Apache/1.3.33.

I am thinking that the only way to force the server to show the new url i开发者_C百科s to use a redirect instead on rewrite. Any ideas?

Any help is sincerely appreciated!


Have you tried this?

RewriteRule ^thispage.html$ thatpage.html [R=301,L]

Alternatively, a Redirect would be easier on the server than a Rewrite...

Redirect 301 thispage.html http://yourDomain.com/thatpage.html


For not display new url, you must delete [R], because [R] is for display new url

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜