1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Maximum number of lines in .htaccess file

Discussion in 'Apache' started by Agent000, Sep 11, 2016.

  1. #1
    Anyone know if there are performance or other issues, etc if there are more then 500-600 301 redirects in a single .htaccess file

    It is the only option I got for a short/medium term problem with a site move.
    Can't use wildcards for this one.
    Long term will eventually whittle them down to a dozen or so.
     
    Agent000, Sep 11, 2016 IP
  2. Furquan Ahmed

    Furquan Ahmed Well-Known Member

    Messages:
    819
    Likes Received:
    76
    Best Answers:
    1
    Trophy Points:
    135
    #2
    Furquan Ahmed, Sep 12, 2016 IP
    Agent000 likes this.
  3. malky66

    malky66 Acclaimed Member

    Messages:
    3,996
    Likes Received:
    2,248
    Best Answers:
    88
    Trophy Points:
    515
    #3
    Depends on what is more important, you will probably see a performance hit, but probably not worth worrying about in the long run, probably more important to make sure the redirects get indexed properly than worrying about the short term performance hit.
    It's a bit tedious but monitor the rankings of the redirects and remove them from htaccess as and when they get indexed.
     
    malky66, Sep 12, 2016 IP
  4. billzo

    billzo Well-Known Member

    Messages:
    961
    Likes Received:
    278
    Best Answers:
    15
    Trophy Points:
    113
    #4
    Using htaccess in the first place is a huge performance hit. Apache's recommendation is to put stuff in the server config files so it is read only one time on server start versus on every request--and traversing up the directory hierarchy--as htaccess does. But htaccess is all that is available on shared hosting (which I assume you are using). And if you are on shared hosting, RewriteMap is not an option either. SOL. Perhaps you could test the time using the redirects and not and find out if there is a performance hit?

    When I had to do mass redirects, I had the old URL and the new URL in a database table. A quick SELECT query takes only a few thousandths of a second (I think about 6/1000ths back in the days of mechanical hard drives). Never would I have considered thousands of redirects in an htaccess file on shared hosting.
     
    billzo, Sep 12, 2016 IP
  5. Agent000

    Agent000 Prominent Member

    Messages:
    5,034
    Likes Received:
    839
    Best Answers:
    6
    Trophy Points:
    390
    #5
    Thanks everyone!
    I will give it a go and test performance.
    Then reduce the lines to a bare minimum and test again.
    Will report back
     
    Agent000, Sep 12, 2016 IP