Jump to content

Mod_Rewrite not working


oshopindia

Recommended Posts

I write following code:

 

RewriteEngine On

RewriteBase /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

Link to comment
Share on other sites

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 1
Do you get a 500 error when trying to browse your website?

 

Oh, and next time you post code, use

 tags.
Link to comment
Share on other sites

<?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 by oshopindia
Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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 working

RewriteBase /grabkkkart1

Options +FollowSymLinks
RewriteEngine on
ErrorDocument 404 http://www.grabkart.com/
RewriteRule ^productdetail/([^/.]+)/?$ productdetail.php?prodid=$1 [L]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.