Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: alternative to mod_rewrite |
|
Author |
|
supersan
Joined: 29 Aug 2008 Posts: 2
|
Posted: Fri 29 Aug '08 10:34 Post subject: alternative to mod_rewrite |
|
|
Hi,
I have a youtube like website where we create URLs like these:
http:// example.com/san/movie1234.html
Here, “san” is the username and “movie1234” is the movie id.
We use mod_rewrite to change this URL internally to a php file like this:
Code: |
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://example.com/load.php?q=$1 [R,P] |
The reason for using an internal proxy instead of redirection is because we do not want the URL in the browse to change.
It has been working for us good, but lately our site loading has been a little slow and I think that it may be because of the extra “file stats” and the proxying for every request which is the cause.
So I’ve been looking for workarounds for achieving the same without doing the above on Apache 2.
Any tips, suggestions and links with regards to this would be greatly appreciated.
Please help me.
Kind Regards,
San. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Tue 02 Sep '08 19:32 Post subject: |
|
|
Caching would help a lot for performance.
a) caching on the proxy
b) caching with PHP on the remoted server. |
|
Back to top |
|
supersan
Joined: 29 Aug 2008 Posts: 2
|
Posted: Wed 03 Sep '08 7:34 Post subject: |
|
|
Hi,
Thanks for the reply. I think caching can certainly help but since most of these pages are dynamically created via php (online users, comments, etc) it won't help my case much. I do use mod_expire with a long time for all images, js, etc to reduce our server loads.
After digging a bit deeper, I found two more alternatives, mentioning here for reference:
1. mod_perl, with HTML Mason as mentioned here does exactly this: http://www.masonbook.com/book/chapter-3.mhtml. I like mod_perl but our initial testing showed that mason becomes unstable under loads and caused our apache installation (win32) to crash frequently, so i'm not a big fan of it right now.
2. Apache ForceType as mentioned here: http://www.evolt.org/article/Making_clean_URLs_with_Apache_and_PHP/18/22880/ This is nice but there needs to be an identifying "/article/" or some other tag but our urls are http://www.example.com/username/ which is why it won't work for us.
What else can you guys suggest? Please help me... |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Wed 03 Sep '08 9:08 Post subject: |
|
|
An alternativ is also to host static stuff on a second server. Like pictures, css files, javascript, everything that is static on static.example.com
That would reduce the the proxy and the remoted server. Also the static server do not need to have much power only a good connection to the net.
If you than still having trouble you should think of load balancing. With apache as loadbalancer there is a bottleneck, but with round robin (DNS based) there won't be a bottle neck. |
|
Back to top |
|
|
|
|
|
|