oshopindia Posted August 16, 2013 Share Posted August 16, 2013 I want to know that mod_rewrite enable or not in my server You can see my php info file here http://www.grabkart.com/phpinfo.php Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/ Share on other sites More sharing options...
requinix Posted August 16, 2013 Share Posted August 16, 2013 (edited) phpinfo() cannot tell you that information. Ask whoever manages your server. [edit] Looks like GoDaddy. Seems like a dedicated server so even if it's not installed you might be able to add it. Edited August 16, 2013 by requinix Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445291 Share on other sites More sharing options...
oshopindia Posted August 16, 2013 Author Share Posted August 16, 2013 I write following code: RewriteEngine OnRewriteBase /grabkkkart1/ RewriteRule productdetail/(.*)/(.*)/$ /productdetail.php?$1=$2 RewriteRule ^index.php$ http://www.grabkart.com/ [R=301] Here, The second RewriteRule ^index.php$ http://www.grabkart.com/ [R=301] is Working and it's Redirecting from http://www.grabkart.com/index.php to http://www.grabkart.com But The first RewriteRule RewriteRule productdetail/(.*)/(.*)/$ /productdetail.php?$1=$2 Not Working I want to convert http://www.grabkart.com/productdetail.php?prodid=59 to http://www.grabkart.com/productdetail/prodid/59 Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445295 Share on other sites More sharing options...
requinix Posted August 16, 2013 Share Posted August 16, 2013 Here, The second RewriteRule ^index.php$ http://www.grabkart.com/ [R=301] is Working and it's Redirecting from http://www.grabkart.com/index.php to http://www.grabkart.com Not for me it isn't. In fact it shouldn't work period because you've created an infinite loop of redirects. Add a line at the bottom of your .htaccess saying TestDirective 1Do you get a 500 error when trying to browse your website? Oh, and next time you post code, use tags. Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445299 Share on other sites More sharing options...
oshopindia Posted August 16, 2013 Author Share Posted August 16, 2013 (edited) When I write TestDirective 1 At the bottom of page it showing 500 error and how can i use tag plz mention with example Edited August 16, 2013 by oshopindia Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445304 Share on other sites More sharing options...
oshopindia Posted August 16, 2013 Author Share Posted August 16, 2013 (edited) plz help Edited August 16, 2013 by oshopindia Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445307 Share on other sites More sharing options...
jazzman1 Posted August 16, 2013 Share Posted August 16, 2013 But The first RewriteRule RewriteRule productdetail/(.*)/(.*)/$ /productdetail.php?$1=$2 Not Working You know what a slash "/" symbol does, right? Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445326 Share on other sites More sharing options...
oshopindia Posted August 16, 2013 Author Share Posted August 16, 2013 Yes I Know What You Want to say Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445330 Share on other sites More sharing options...
jazzman1 Posted August 16, 2013 Share Posted August 16, 2013 Yes I Know What You Want to say Is there a file productdetail.php inside web root? Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445401 Share on other sites More sharing options...
oshopindia Posted August 17, 2013 Author Share Posted August 17, 2013 yes there is one file named productdetail.php Our website Hosted on Godaddy Server We have Multiple hosting facilities in our Hosting Plans So We have to do extra coding for it? Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445484 Share on other sites More sharing options...
oshopindia Posted August 17, 2013 Author Share Posted August 17, 2013 (edited) <?php if( !function_exists('apache_get_modules') ) { echo "mod_rewrite not enable"; } else(function_exists('apache_get_modules') ) { echo "mod_rewrite enable"; } ?> I write This code For To know mod_rewrite enable or not on my server Is This code True It is showing "mod_rewrite not enable" Edited August 17, 2013 by oshopindia Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445488 Share on other sites More sharing options...
jazzman1 Posted August 17, 2013 Share Posted August 17, 2013 Apache and php are two different things! You can apply apache rewriting rules without php at all. So, back to the problem above, can I see the link that you wanna be matched. Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445492 Share on other sites More sharing options...
oshopindia Posted August 17, 2013 Author Share Posted August 17, 2013 I want to convert http://www.grabkart.com/productdetail.php?prodid=99 Url Into http://www.grabkart.com/productdetail/prodid/99 We have Multiple hosting facilities in our Hosting Plans So We have to do extra coding for it? Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445494 Share on other sites More sharing options...
jazzman1 Posted August 17, 2013 Share Posted August 17, 2013 (edited) Well, your regexp pattern is wrong in that case PS: This is a good article for beginners. Edited August 17, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445495 Share on other sites More sharing options...
oshopindia Posted August 17, 2013 Author Share Posted August 17, 2013 (edited) What is regexp pattern I Dont Know about It Give me solution of this Issue Edited August 17, 2013 by oshopindia Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445496 Share on other sites More sharing options...
oshopindia Posted August 17, 2013 Author Share Posted August 17, 2013 Here You all Can Read That Go daddy says that We cannot check if the mod_rewrite module is loaded via phpinfo is this true? Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445499 Share on other sites More sharing options...
jazzman1 Posted August 17, 2013 Share Posted August 17, 2013 Yep, you should read that for sure. Don't be a lazy boy or girl Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445503 Share on other sites More sharing options...
oshopindia Posted August 19, 2013 Author Share Posted August 19, 2013 <?php if( !function_exists('apache_get_modules') ){ echo "mod_rewrite not enable"; } ?> Is It True Code To Know That Mod_rewrite installed or not on my server Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445789 Share on other sites More sharing options...
jazzman1 Posted August 19, 2013 Share Posted August 19, 2013 Why do you want to use this apache module in php? If godaddy does not provide you by default this option (check inside php.ini file), just you don't need that. I'm on godaddy too and often use apche mod_rewite without php at all. Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1445844 Share on other sites More sharing options...
oshopindia Posted August 21, 2013 Author Share Posted August 21, 2013 How can We Use apache Mod_rewrite without php Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1446069 Share on other sites More sharing options...
oshopindia Posted August 21, 2013 Author Share Posted August 21, 2013 In My .htaccess ErrorDocument 404 http://www.grabkart.com/ rule is working But RewriteRule ^productdetail/([^/.]+)/?$ productdetail.php?prodid=$1 [L] Rule is not working I don't Know why This Both Rule You can see in http://www.branded3.com/blogs/htaccess-mod_rewrite-ultimate-guide/ Here is my .htaccess file # Do not remove this line, otherwise mod_rewrite rules will stop workingRewriteBase /grabkkkart1Options +FollowSymLinksRewriteEngine onErrorDocument 404 http://www.grabkart.com/RewriteRule ^productdetail/([^/.]+)/?$ productdetail.php?prodid=$1 [L] Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1446074 Share on other sites More sharing options...
oshopindia Posted August 21, 2013 Author Share Posted August 21, 2013 I want to Convert http://www.grabkart.com/productdetail.php?prodid=3560 to http://www.grabkart.com/productdetail/3560 But my RewriteRule RewriteRule ^productdetail/([^/.]+)/?$ productdetail.php?prodid=$1 [L] Not Working On Productdetail page I use 3560 use by get methode So does get methode effect the RewriteRule Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1446083 Share on other sites More sharing options...
jazzman1 Posted August 22, 2013 Share Posted August 22, 2013 Wrong pattern! Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1446278 Share on other sites More sharing options...
oshopindia Posted August 23, 2013 Author Share Posted August 23, 2013 Wrong Pattern Means What If This is Wrong Pattern Then What is Right Pattern Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1446448 Share on other sites More sharing options...
jazzman1 Posted August 23, 2013 Share Posted August 23, 2013 Create your fake URL in the format as you want to be, then apply a rule for it. Example: <a href="./productdetail/34231">Product Detail</a> .htaccess RewriteRule ^/?productdetail/([^/]+)/?$ productdetail.php?prodid=$1 [L] Quote Link to comment https://forums.phpfreaks.com/topic/281230-mod_rewrite-not-working/#findComment-1446451 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.