开发者

How to configure apache server for sending a 301 code in response

I want to to configure Apache for moved permanently response.

What ever idea I have about this is --

1) I need to add below line in httpaccess Redirect 301 /e/301 Can I put this line any where in httpaccess file?

2) then I have to have a page (say it is redirect.html, ) put in /var/www/html/project_name.

Which will be displayed on redirection(will show 301 code).

Now what I want is, if someone access the page example.html, it need to be redirected to redirect.html .

Where and what sy开发者_Go百科ntax I need to add or what changes need to be done in httpd or other different Apache files.

Please correct me if I am wrong in above two points.

Thanks alot.


Got a solution- We can do it be using Redirection directory or by re-write engine in httpdaccess.conf

for doing this by re-write engine add below line in conf file

RewriteEngine On

for 302 code

RewriteRule /.* http://www.new_server.com/ [R]

for 301 - permanent redirecting the your side to another one

RewriteRule permanent /.* http://www.new_server.com/ [R]

for page

Redirect /old.html http://ww.new_server.com/new.html

Redirect permanent /old.html http://www.new_server.com/new.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜