Search code examples
.htaccesshttp-redirecthttp-status-code-301

htaccess 301 redirctions of a single file


I have this .htaccess code:

Options +FollowSymLinks  
RewriteEngine On   

RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^articles/([^/\.]+)/?$  articles.php?url=$1 
RewriteRule ^([^/\.]+)/?$  articles.php?t=$1 

Redirect 301 /html/index.php http://www.mysite.com/html
Redirect 301 /‪html/html_syntax.php http://www.mysite.com/articles/html-syntax
Redirect 301 /html/favicon.php‬ http://www.mysite.com/articles/how-to-create-favicon
Redirect 301 /articles/html-anchore‬ http://www.mysite.com/articles/html-anchor

But for some reason, none of the 301 Redirections works, any suggestions? I have tried using:

    RedirectMatch 301 ^/oldpage\.php$‬ http://www.mysite.com/newpage.php

But that didnt work either.


Solution

  • After the agent from Godaddy was not able to solve my issue, I decided to go to my GoDaddy account and use the Redirect tool they have there. After creating some redirects using the tool I opned my .htaccess file to look for what changes were made. GoDaddy is using the rewriterule to creat redirects. Here is what I saw:

    rewriterule ^folder\/oldFile\.html "http\:\/\/mysite\.com\/folder\/newFile\.html" [R=301,L] #4f47f0ade2879
    

    the number at the end is probably used by the GoDaddy tool as a unique key for that redirect. everything works now!