How Can I optimize this RewriteEngine Code?

Posted by Lucki Mile on Stack Overflow See other posts from Stack Overflow or by Lucki Mile
Published on 2012-10-08T21:35:33Z Indexed on 2012/10/08 21:36 UTC
Read the original article Hit count: 216

Filed under:
|

I have server overload, server admin said that this issue is caused from htaccess file

This is the code:

RewriteEngine On
RewriteBase /here/
RewriteRule ^top/?$ index.php?mode=top [QSA]
RewriteRule ^top/video/?$ index.php?mode=top&cat=vids [QSA]
RewriteRule ^top/picture/?$ /index.php?mode=top&cat=pics [QSA]

RewriteRule ^random$ index.php?mode=random [QSA]
RewriteRule ^random/video/?$ index.php?mode=random&cat=vids [QSA]
RewriteRule ^random/picture/?$ index.php?mode=random&cat=pics [QSA]

RewriteRule ^new/?$ index.php [QSA]
RewriteRule ^new/video/?$ index.php?mode=&cat=vids [QSA]
RewriteRule ^new/picture/?$ index.php?mode=&cat=pics [QSA]

RewriteRule ^video/([0-9]+)_(.*)$ item.php?cat=vids&id=$1 [QSA]
RewriteRule ^picture/([0-9]+)_(.*)$ item.php?cat=pics&id=$1 [QSA]
ErrorDocument 404 /item.php

© Stack Overflow or respective owner

Related posts about php

Related posts about mod-rewrite