lovesmith Posted February 14, 2008 Share Posted February 14, 2008 my mod_rewrite module is turned on in the configuration file. I m trying to use mod rewrite in my local machine i have a folder urlrewriting and inside it all the files and .htaccess files exist i have following code in httaccess file. Options +FollowSymLinks RewriteEngine on RewriteBase /urlrewriting/ RewriteRule productinfo/proid/(.*)/ productinfo.php?proid=$1 all i want to do is rewrite http://localhost/urlrewriting/productinfo.php?proid=12 to http://localhost/urlrewriting/productinfo/proid/12/ But it didnt worked. I have test.php where there is a link like this <a href="productinfo.php?proid=12">Product 12</a> the link still goes to http://localhost/urlrewriting/productinfo.php?proid=12 Where i went wrong? Somebody help me And even custome error page is not working as well i have code in same htaccess file ErrorDocument 404 /err/404.php i have folder "err" and the page as well it didnt worked...anybody tell me how to make these work? Thanks a ton in advance lovesmith Quote Link to comment https://forums.phpfreaks.com/topic/91021-mod-rewrite-and-custom-error-page-redirection-problem/ Share on other sites More sharing options...
Daniel0 Posted February 14, 2008 Share Posted February 14, 2008 my mod_rewrite module is turned on in the configuration file. I m trying to use mod rewrite in my local machine i have a folder urlrewriting and inside it all the files and .htaccess files exist i have following code in httaccess file. Options +FollowSymLinks RewriteEngine on RewriteBase /urlrewriting/ RewriteRule productinfo/proid/(.*)/ productinfo.php?proid=$1 all i want to do is rewrite http://localhost/urlrewriting/productinfo.php?proid=12 to http://localhost/urlrewriting/productinfo/proid/12/ But it didnt worked. I have test.php where there is a link like this <a href="productinfo.php?proid=12">Product 12</a> the link still goes to http://localhost/urlrewriting/productinfo.php?proid=12 Where i went wrong? Somebody help me I think you've misunderstood how mod_rewrite works. It does not make links look in another way once they're output but it rewrites the URLs which are requested. I.e. if the user enters http://localhost/urlrewriting/productinfo/proid/12/ into the address bar it would have worked as had he typed http://localhost/urlrewriting/productinfo.php?proid=12. And even custome error page is not working as well i have code in same htaccess file ErrorDocument 404 /err/404.php i have folder "err" and the page as well it didnt worked...anybody tell me how to make these work? How exactly doesn't it work? If you go to a page which you know doesn't exist you should get the /err/404.php page instead. Doesn't that work? Quote Link to comment https://forums.phpfreaks.com/topic/91021-mod-rewrite-and-custom-error-page-redirection-problem/#findComment-466735 Share on other sites More sharing options...
lovesmith Posted February 15, 2008 Author Share Posted February 15, 2008 well url rewriting problem is solved for next i tried to browse http://localhost/urlrewriting/abc.php ....abc.php doesnot exist. instead of custom error document...it show internet explorer's default page not found error. Quote Link to comment https://forums.phpfreaks.com/topic/91021-mod-rewrite-and-custom-error-page-redirection-problem/#findComment-467435 Share on other sites More sharing options...
Daniel0 Posted February 15, 2008 Share Posted February 15, 2008 It's because IE sucks. There is the Microsoft way and then there is the standard way. IE will not show custom error pages unless they are over 512 kB in size. Quote Link to comment https://forums.phpfreaks.com/topic/91021-mod-rewrite-and-custom-error-page-redirection-problem/#findComment-467455 Share on other sites More sharing options...
lovesmith Posted February 15, 2008 Author Share Posted February 15, 2008 OKay thanks for the information Quote Link to comment https://forums.phpfreaks.com/topic/91021-mod-rewrite-and-custom-error-page-redirection-problem/#findComment-467461 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.