Forum Moderators: phranque

Message Too Old, No Replies

How many lines can we use in .htaccess

mod re-write lines

         

blue_eagle

4:21 am on Sep 25, 2005 (gmt 0)

10+ Year Member



I am using mod re-write in .htaccess file and there are many many lines as rule. However, I am worried that there is a limit in .hraccess file and won't see the rules after a certaing line. What i ask is is there a line limit in .htaccess file or is it as many as I want?

Thanks in advance.

jdMorgan

4:54 am on Sep 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know -- I've never had any problems, and on some shared hosting sites I probably have 1000 lines or more -- Not all mod_rewrite lines, but mostly. In addition to redirecting old URLs, these lines implement access control by user-agent, IP address, and referrer, limit known-good robots to certain directories in case they or I make a mistake in robots.txt, and block bad robots. I also detect and redirect mis-targeted search terms to resource pages for people who come to the site using search terms that appear in the site, but don't have anything to do with our topic. For example, we get a lot of people coming to our site [b]map[/p] page looking for geographical maps of the area, because they didn't read the page description in the search results. I redirect those visitors to a page with links to map providers. There's also cache control and various other configuration stuff in there. So there's a lot of stuff in there that is not plain URL rewrites/redirects.

If you've got more than 1000 lines in your .htaccess file, you may want to look into ways to use one ruleset to rewrite/redirect more than one URL if you're not doing so already.

Jim

andrea99

5:22 am on Sep 25, 2005 (gmt 0)



I have had an .htaccess file as big as 24k, I don't recall how many lines but it was 95% 301 redirects. It never did unbalance the server but my sysadmin said it might if a few spiders began hammering it and if that happened the file would have to be removed.

These do slow down response time.

blue_eagle

10:22 pm on Sep 25, 2005 (gmt 0)

10+ Year Member



Actually i believe i am using that much line because i am a novice mod re-write person. Ok lets see, I am using this line :

/manufacturers/gift/atv.php?subaction=showfull&id=$1&archive=&start_from=&ucat=$2

and i would like to use a simple term that will re write everything manufacturers/gift/

so i wont need to list lines like this.

/manufacturers/gift/atv.php?subaction=showfull&id=$1&archive=&start_from=&ucat=$2
/manufacturers/gift/cat1.php?subaction=showfull&id=$1&archive=&start_from=&ucat=$2
/manufacturers/gift/cat2.php?subaction=showfull&id=$1&archive=&start_from=&ucat=$2
and goes on.

Basically, in simple computer english i want this

/manufacturers/gift/*.*.php?subaction=showfull&id=$1&archive=&start_from=&ucat=$2

by using that type of line i won't have to list all categories under gift.

If you can help me about this issue, I would really appreciate that.

Sincerely..

broniusm

9:06 pm on Sep 28, 2005 (gmt 0)

10+ Year Member



blue-
what do you expect the incoming request to look like, and what should that request be "translated" to?

JAB Creations

5:33 pm on Sep 29, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My htaccess is 200KB. :-D