Hi Guys, This is my first post and I would like to take the opportunity to say hello to all the PHP experts and newbies like me. I just got one of my website developed by a freelancer developer and recently there are some issues with the URL rewriting. The website is working fine on the local server (windows based with Xampp) but there are problems when it went online. The website is based around the Televisions and the structure is more or less like; domainname com/lg-tvs.html domainname com/lg/lge545.html domainname com/store/lgeshop.html domainname com/screen/42-inch-lcd.html whereas the first url is working fine on the online server but not the rest of them. The coding is done in a way that when ever someone, is trying to access the page that doesn't exist or manually enter the details in url, it goes to error.html page. Hence in rest of the above cases the browser is automatically redirected to error.html page. I am using the following rules in the htaccess; RewriteEngine On RewriteRule ^index\.html$ index.php RewriteRule ^error\.html$ error.php RewriteRule ^([a-zA-Z0-9_-]+)\.html$ manufacturer.php?pagename=$1 RewriteRule ^pages/([a-zA-Z0-9_-]+)\.html$ content.php?page=$1 [L] RewriteRule ^screensize/([a-zA-Z0-9_-]+)\.html$ screensize.php?page=$1 [L] RewriteRule ^shops/([a-zA-Z0-9_-]+)\.html$ merchant.php?page=$1 [L] RewriteRule ^(.*)/([a-zA-Z0-9_-]+)\.html$ products.php?page=$1 Can you please revert and confirm if there is something that can be done to get rid of this issue. Also, the freelancer developer who developed it, will only be available after 15 days so either I try my luck here and try to solve the issue or wait until he comes back. Thanks in advance. Mike...
Hi, Mike, why not using ErrorDocument directly: ErrorDocument 404 error.php Redirect 404 error.php Code (markup): Also seems that "-" must be escaped (or placed first): [a-zA-Z0-9_\-] or [-a-zA-Z0-9_] Regards
Hi Guys, Thanks for the update but the one suggested isn't really working for me. I guess there is something else that might be causing the issue. Also, to add, the same worked once without any changes in the htaccess or the php code but that too just once and stopped all of sudden. Thanks, Mike...