PDA

View Full Version : apache2 & htaccess


angst
11-23-2009, 03:58 PM
hello,
I'm using apache2 and htaccess to turn long urls into more seo friendly strings, example: www.domain.com/products/ ( which is really www.domain.com/?page=products )

however in the error.log I see tons of this:

File does not exists: /home/domain/products

is this normal or have i set this up incorrectly? I'm on a new server now and these seo friendly strings appear to be slowing down the site, if I go to my backend with just normal url's the response time is much better. any ideas would be great!

abduraooft
11-23-2009, 04:20 PM
Could you show your htaccess file contents used for this rewrites? Are you relying on the the ErrorDocument directive?

angst
11-23-2009, 04:24 PM
sure, here it is:


RewriteEngine On
RewriteBase /

######### Error Control #########

RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
ErrorDocument 404 /

######### Common Pages #########

RewriteRule ^page/([A-Za-z-]+)/?$ index.php?page=$1 [NC,L] # Hand Pages
RewriteRule ^content/([A-Za-z0-9-]+)/?$ index.php?page=content&PageID=$1 [NC,L] # Handle Content requests
RewriteRule ^lessons/?$ index.php?page=content&PageID=5 [NC,L] # Handle Lessons Page
RewriteRule ^terms/?$ index.php?page=content&PageID=8 [NC,L] # Handle Lessons Page

######### Contact Page #########

RewriteRule ^contact/?$ index.php?page=contact [NC,L] # Handle Department Page
RewriteRule ^contact/([A-Za-z0-9-]+)/?$ index.php?page=contact&msg=$1 [NC,L] # Handle Contact requests

######### Join Us Page #########

RewriteRule ^joinus/?$ index.php?page=joinus&PageID=11 [NC,L] # Handle joinus Page
RewriteRule ^joinus/([A-Za-z0-9-]+)/?$ index.php?page=joinus&PageID=11&msg=$1 [NC,L] # Handle joinus requests

######### Events Pages #########

RewriteRule ^events/?$ index.php?page=whatson [NC,L] # Handle Events Page
RewriteRule ^events/([0-9-]+)/?$ index.php?page=whatson&ProvincesID=$1 [NC,L] # Handle Event/Whats On requests
RewriteRule ^events/([0-9-]+)/([0-9-]+)/?$ index.php?page=whatson&ProvincesID=$1&CurrentCount=$2 [NC,L] # Handle Event/Whats On - paging requests
RewriteRule ^news/([0-9-]+)/?$ index.php?page=news&NewsID=$1 [NC,L] # Handle news requests

######### Locations Pages #########

RewriteRule ^location/([0-9-]+)/?$ index.php?page=locations&LocationsID=$1 [NC,L] # Handle Locations Cities Pages
RewriteRule ^locations/([A-Za-z0-9-]+)/?$ index.php?page=locations&ProvincesID=$1 [NC,L] # Handle Locations Provinces Pages
RewriteRule ^locations/?$ index.php?page=locations [NC,L] # Handle Department Page

######### Department Pages #########

RewriteRule ^departments/?$ index.php?page=departments [NC,L] # Handle Department Page
RewriteRule ^departments/([A-Za-z0-9-]+)/?$ index.php?page=departments&DepartmentsID=$1 [NC,L] # Handle Department Pages
RewriteRule ^departments/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?page=departments&DepartmentsID=$1&action=$2 [NC,L] # Handle Department Pages
RewriteRule ^departments/([0-9-]+)/([0-9-]+)/([0-9-]+)/([0-9-]+)/?$ index.php?page=departments&DepartmentsID=$1&CurrentCount=$2&FilterBrand=$3&FilterCost=$4 [NC,L] # Handle Department Pages

# Department Pages

RewriteRule ^audio/?$ index.php?page=departments&DepartmentsID=9 [NC,L] # Pro Audio & Recording
RewriteRule ^drums/?$ index.php?page=departments&DepartmentsID=6 [NC,L] # Drums
RewriteRule ^guitars/?$ index.php?page=departments&DepartmentsID=5 [NC,L] # Guitars
RewriteRule ^print/?$ index.php?page=departments&DepartmentsID=62 [NC,L] # print music
RewriteRule ^keyboards/?$ index.php?page=departments&DepartmentsID=8 [NC,L] # Keyboards
RewriteRule ^software/?$ index.php?page=departments&DepartmentsID=58 [NC,L] # software
RewriteRule ^band/?$ index.php?page=departments&DepartmentsID=71 [NC,L] # Band


######### Products Pages #########

RewriteRule ^products/([0-9-]+)/?$ index.php?page=products&ProductsID=$1 [NC,L] # Handle products Pages
RewriteRule ^products/([0-9-]+)/([0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?page=products&ProductsID=$1&ChildProductID=$2&msg=$3 [NC,L] # Handle products add to cart Pages
RewriteRule ^Review/([0-9-]+)/?$ index.php?page=Review&ProductsID=$1 [NC,L] # Handle Review Pages
RewriteRule ^productdemo/([0-9-]+)/?$ index.php?page=productdemo&ProductsID=$1 [NC,L] # Handle Demo Pages
RewriteRule ^WriteReview/([0-9-]+)/?$ index.php?page=WriteReview&ProductsID=$1 [NC,L] # Handle Write Review Pages
RewriteRule ^WriteReview/([0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?page=WriteReview&ProductsID=$1&msg=$2 [NC,L] # Handle Write Review Pages

# Product Brands
RewriteRule ^brands/?$ index.php?page=Brands [NC,L] # Handle Brands Page
RewriteRule ^brands/([A-Za-z-]+)/?$ index.php?page=Brands&alpha=$1 [NC,L] # Handle Brands Pages

# new products
RewriteRule ^newproducts/?$ index.php?page=newproducts [NC,L] # Handle Department Page
RewriteRule ^newproducts/([0-9-]+)/?$ index.php?page=newproducts&CurrentCount=$1 [NC,L] # Handle Department Pages

######### Search Pages #########

RewriteRule ^search/?$ index.php?page=search [NC,L] # Handle Search Page
RewriteRule ^search/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ index.php?page=search&filter=$1&SearchTxt=$2 [NC,L] # Handle Department Pages


######### Cart & Checkout #########

RewriteRule ^cart/?$ index.php?page=cart [NC,L] # Handle Department Page

######### user reg & account #########

RewriteRule ^myaccount/?$ index.php?page=myaccount [NC,L] # Handle MyAccount Page
RewriteRule ^myaccount/([A-Za-z0-9-]+)/?$ index.php?page=myaccount&msg=$1 [NC,L] # Handle MyAccount msg Page

# register
RewriteRule ^register/?$ index.php?page=register_account [NC,L] # Handle register Page
RewriteRule ^register/([A-Za-z0-9-]+)/?$ index.php?page=register_account&msg=$1 [NC,L] # Handle register msg Page





I should also mentioned that I just moved to a new server as my last one crashed, and this all ran very fast on the last server, not I'm getting a very slow response time when trying to pull pages. I'm running Ubuntu server w/apache2 and it's a very powerful machine with 8gigs of ram and tons of CPU available, so I'm not really sure what the issue could be.

thanks again for your time!