SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I redirect a link without .html

    Sorry if this isn't the correct forum. Please tell me where I should ask this. I'm not even sure if I'm phrasing the question correctly!

    In a text document, I want to write "Go to example.com/foo" and when they type "example.com/foo" in to the address bar, I want them to go to "http://www.example.com/bar/foo.html".

    I can't figure out how to do that. In.htaccess, I've tried this, but it doesn't work (goes to file not found page):

    Redirect 301 http://www.example.com/foo http://www.example.com/bar/foo.html

    Anyone have any ideas? Thanks in advance!

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Does /bar/foo.html exist? mod_alias matches on paths, not URLs:

    Code:
    Redirect 301 /foo http://www.example.com/bar/foo.html
    http://httpd.apache.org/docs/2.2/mod....html#redirect

  3. #3
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,604
    Mentioned
    19 Post(s)
    Tagged
    2 Thread(s)


    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  4. #4
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Grossman View Post
    Does /bar/foo.html exist? mod_alias matches on paths, not URLs:

    Code:
    Redirect 301 /foo http://www.example.com/bar/foo.html
    http://httpd.apache.org/docs/2.2/mod....html#redirect
    That worked! Guess I didn't understand mod_alias correctly. Thank you!


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
  •