WordPress.org

Support

Support » How-To and Troubleshooting » 301 Redirect is not working as expected

301 Redirect is not working as expected

  • umesh.awasthi
    Member

    @umeshawasthi

    Trying to set 301 redirect in .htaccess file and here is what i am trying to do

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^http://localhost/wordpress/$ [OR]
    RewriteCond %{HTTP_HOST} ^localhost/wordpress/$
    RewriteRule (.*)$ http://www.mysite.com/wordpress/$1 [R=301,L]

    I am testing this on my local machine using WAMPP server.Though when i hit http://localhost/wordpress/ i am getting redirected to http://www.mysite.com/wordpress/ but for other URL i am not getting redirected at all.for e.g

    i have this URL in my local machine http://localhost/wordpress/2010/11/shadows/ and this at the server http://www.mysite.com/wordpress/2010/11/shadows/ but when i hit this URL i am not getting redirected to respected URL on the live server ,but i am being showed same page from local machine

    can any one tell me whats wrong with the redirection entry Thanks in advance

  • The topic ‘301 Redirect is not working as expected’ is closed to new replies.