Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Mar 2010
    Posts
    235
    Thanks
    39
    Thanked 6 Times in 6 Posts

    301 redirect to .html extension

    I have 50 files on a website, but only want 3 of them to redirect to .html, so I cannot do a redirect all to .html.

    Here is one of them.

    test.com/master

    I want to redirect that to test.com/master.html

    I tried this, but it keeps clocking on the page:

    Code:
    RewriteRule ^/test http://www.mysite.com/test.html [R=301,L]
    I also tried this:

    Code:
    RewriteRule ^/test$ http://www.mysite.com/test.html [R=301,L]
    and this:

    Code:
    RewriteRule ^/test!\.html$ http://www.teachhub.com/test.html [R=301,L]
    Last edited by mathceleb; 10-12-2012 at 11:37 PM.

  • #2
    Regular Coder
    Join Date
    Mar 2010
    Posts
    235
    Thanks
    39
    Thanked 6 Times in 6 Posts
    clearing cache on Drupal, this appears to work?

    Code:
    RewriteRule ^test!\.html$ http://www.mysite.com/test.html [R=301,L]

  • #3
    Regular Coder patryk's Avatar
    Join Date
    Oct 2012
    Location
    /dev/couch
    Posts
    398
    Thanks
    2
    Thanked 64 Times in 64 Posts
    how about using redirect for redirecting and rewrite for rewriting?
    Code:
    Redirect 301 /document.php http://domain.com/other-document.php


  •  

    Posting Permissions

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