SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2007
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    htaccess question

    Hi,

    I am trying to redirect users who are accessing an images folder using htaccess. I can do this, but wanted to know if there is a way to include the folder with / at the end. At the moment, I have to have two lines like this:

    PHP Code:
    RewriteRule ^imageshttp://www.website.com/ [R=301,L] 
    RewriteRule ^images/$ http://www.website.com/ [R=301,L] 
    Thanks

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

    You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It's helped may members and should help you, too.

    That's the long answer. The short one is to delete the first RewriteRule and add a ? after the / in the second. What you've asked about is known as a metacharacter where ? denotes zero or one of the previous character, + denotes one or more and * denotes zero or more (and you DON'T want images/////////!!!).

    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
  •