SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Nov 2009
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .htaccess 301 redirect

    Hello I have a question for anyone that can answer it. I need to redirect a page on my site that no longer existed.

    I need example.com/freebies.php to redirect to example.com/freebies

    The problem is when I use a regular redirect it creates an infinite loop
    I.E. Redirect 301 /freebies.php /freebies

    Thanks in advance

  2. #2
    Non-Member thewebhostingdir's Avatar
    Join Date
    Oct 2005
    Posts
    703
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You will have to write the 301 redirect code in your .htaccess file and have a try.

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

    First, WELCOME to SitePoint's Apache forum!

    I really see no problem with your mod_alias statement (except that I would have added a trailing / to the redirect).

    I'd actually try TWHD's suggestion, though, but only because I'm far more familiar with mod_rewrite than I am with the nuances of mod_alias.
    Code:
    RewriteEngine on
    RewriteRule ^freebies\.php$ freebies/ [R=301,L]
    It says the same thing as your mod_alias Redirect statement but mod_rewrite has to start the regex engine which is a waste of time on such a simple redirect.

    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


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
  •