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

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.

<?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"

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?

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. 

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]

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

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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.