Has a huge redirect list in .htaccess problem?

I want to redirect each post to 301 redirects, but I have over 3000 posts.

If I have listed

Redirect permanent /blog/2010/07/post.html http://new.blog.com/2010/07/23/post/
Redirect permanent /blog/2010/07/post1.html http://new.blog.com/2010/07/24/post1/
Redirect permanent /blog/2010/07/post2.html http://new.blog.com/2010/07/25/post2/
Redirect permanent /blog/2010/07/post3.html http://new.blog.com/2010/07/26/post3/
Redirect per......

for over 3000 URL redirection commands in .htaccess, can this lead to my server resource or cause some problems? I'm not sure how .htaccess works, but if the server scans these lists every time a user requests a page, I would assume that it would be a hog resource.

I cannot use RedirectMatch because I added a new date variable to my new URL. Do you have any other suggestions redirecting these messages? Or am I just fine?

Thank!

+5
source share
4

Apache, , 3 000 .htaccess( , , , ). , , mod_rewrite ?

RewriteRule ^/blog/(.+)/(.+)/(.+).html$ http://new.blog.com/$1/$2/$3/ [R=permanent]

URL- . [R=permanent] mod_rewrite 301 URL , .

, URL-, URL-. , , , , . URL-, .

. , , . ( " RedirectMatch, url." ) mod_rewrite RewriteMap .

:

  • - . , URL- , URL.
  • script, .

posts.txt :

/yyyy/mm/pppp dd

... , yyyy - , mm - , pppp - ( .html).

, :

$ httxt2dbm -i posts.txt -o posts.map 

/ : ( , , URL-.)

RewriteMap postday dbm:/path/to/file/posts.map
RewriteRule ^/blog/(.+)/(.+)/(.+).html$ http://new.blog.com/$1/$2/${postday:$1/$2/$3}/$3/ [R=permanent]

pgm:/path/to/script/lookup.whatever RewriteMap. script . mod_rewrite.

mod_rewrite , script, , . 301 302 , .

+7

- , . mod_rewrite, - .html < > nofollow noreferrer → URL- 301 .

php :

$_SERVER['REQUEST_URI']

URL

header("Location: http://new.blog.com/$y/$m/$d/$title/",TRUE,301);

.

+1

... . , , , , , , , , , . , , . ( , 3000 Apache, )

, , , - . animuson, URL-, RewriteRule . PHP , , , . , , , . , -

RewriteRule .* /blog/index.php

PHP script , . , , PHP , , , Location URL.

RewriteMap, RewriteRule, , . , URL-, Apache . (. ) . , , , 3000.

: Apache , (, Redirect) .htaccess. , 3000 .htaccess . vhost, , RewriteRule.

+1

. , PHP, , , URL . Apache, URL ( URL-, ) . 5 , , , 3000 - .

, URL-, , , -, PHP, , , , URL.

, , , , , , URL- 3000 . URL-, , , .

0

All Articles