Welcome to TalkGraphics.com
Results 1 to 8 of 8
  1. #1

    Default Problems doing a URL redirect in .htaccess

    I've tried dozens of different "solutions" and syntaxing (Redirect, RewriteCond, RewriteRule, Redirect 301, etc) and I just can't get this to work. I often get the "redirect loop" -error or the redirect doesn't work at all, or I get it working with only www.thesite.com and not http://www.thesite.com

    What I want to do:
    When the user goes to mysite.com I want him or her redirected to mysite.com/#anchor
    And if the user goes to www.mysite.com I want him or her redirected to mysite.com/#anchor as well
    ...and if the user goes to http://www.mysite.com I want him or her redirected to mysite.com/#anchor

    ...and yea, I can only get one of these working at a time (or I get a loop).

    My .htaccess file without any redirects:
    Code:
    # enable basic rewriting
    RewriteEngine on
    
    # enable symbolic links
    Options +FollowSymLinks
    
    # enable allowoverride privileges
    <Directory /www/replace/this/with/actual/directory>
     AllowOverride Options
    </Directory>
    
    # do not allow anyone else to read your .htaccess file
    <Files .htaccess>
    deny from all
    </Files>
    
    # forbid viewing of directories
    Options All -Indexes
    
    # disable the server signature- helps with preformance
    ServerSignature Off

  2. #2
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,498

    Default Re: Problems doing a URL redirect in .htaccess

    Welcome to TalkGraphics

    What Xara product are you using?

  3. #3
    Join Date
    Aug 2007
    Location
    Maghull UK
    Posts
    6,202

    Default Re: Problems doing a URL redirect in .htaccess

    <!-- Script courtesy of http://www.web-source.net - Your Guide to Professional Web Site Design and Development
    window.location="http://www.yourdomain.com/";
    // -->

    Place into the HEAD section by using a placeholder or via web properties dialogue, though whether it works with an anchor I don't know
    JOHN -XaReg (FB) XaReg (DB - ignore prompt to register)
    Windows 10 [Anniversary] pro Intel Pentium CPU G630 @ 2.70Ghz RAM: 4 GB; 64-bit x64

  4. #4
    Join Date
    May 2014
    Posts
    25

    Default Re: Problems doing a URL redirect in .htaccess

    It is simple

    Just add Redirect 301 / mt-example.com

  5. #5
    Join Date
    Jun 2014
    Posts
    46

    Default Re: Problems doing a URL redirect in .htaccess

    This one is correct code for redirection

    Quote Originally Posted by diyaldin View Post
    It is simple

    Just add Redirect 301 / mt-example.com

  6. #6
    Join Date
    Aug 2014
    Location
    Dubai, UAE
    Posts
    3

    Default Re: Problems doing a URL redirect in .htaccess

    This is simple code

    E.g

    Redirect 301 / mt-example.com

  7. #7
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,498

    Default Re: Problems doing a URL redirect in .htaccess

    Is there an echo in here?

  8. #8
    Join Date
    May 2014
    Posts
    30

    Default Re: Problems doing a URL redirect in .htaccess

    This source might help you redirecting page through 2 to 3 methods please check

    https://support.google.com/webmaster...er/93633?hl=en

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •