Jump to content


Photo

Mod_Rewrite not working

apache mod_rewrite .htaccess

  • Please log in to reply
45 replies to this topic

#1 oshopindia

oshopindia

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 16 August 2013 - 02:16 AM

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

#2 requinix

requinix

    Transforming Moderator

  • Moderators
  • 6,131 posts
  • LocationWA

Posted 16 August 2013 - 02:55 AM

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 by requinix, 16 August 2013 - 02:55 AM.


#3 oshopindia

oshopindia

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 16 August 2013 - 03:10 AM

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....l.php?prodid=59

to

http://www.grabkart....etail/prodid/59



#4 requinix

requinix

    Transforming Moderator

  • Moderators
  • 6,131 posts
  • LocationWA

Posted 16 August 2013 - 03:45 AM

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 [code] tags.

#5 oshopindia

oshopindia

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 16 August 2013 - 03:50 AM

When I write TestDirective 1 At the bottom of page

it showing 500 error

and how can i use [code=auto:0] tag plz mention with example


Edited by oshopindia, 16 August 2013 - 04:05 AM.


#6 oshopindia

oshopindia

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 16 August 2013 - 04:06 AM


plz help

Edited by oshopindia, 16 August 2013 - 04:07 AM.


#7 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,660 posts
  • LocationMississauga, Canada

Posted 16 August 2013 - 05:59 AM

But The first RewriteRule RewriteRule productdetail/(.*)/(.*)/$ /productdetail.php?$1=$2 Not Working

 

You know what a slash "/" symbol does, right?



#8 oshopindia

oshopindia

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 16 August 2013 - 06:49 AM

Yes I Know

What You Want to say



#9 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,660 posts
  • LocationMississauga, Canada

Posted 16 August 2013 - 01:17 PM

Yes I Know

What You Want to say

 

Is there a file productdetail.php inside web root?



#10 oshopindia

oshopindia

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 17 August 2013 - 04:45 AM

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?



#11 oshopindia

oshopindia

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 17 August 2013 - 06:11 AM

<?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, 17 August 2013 - 06:22 AM.


#12 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,660 posts
  • LocationMississauga, Canada

Posted 17 August 2013 - 06:29 AM

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.



#13 oshopindia

oshopindia

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 17 August 2013 - 06:32 AM

I want to convert
http://www.grabkart....l.php?prodid=99

Url Into
http://www.grabkart....etail/prodid/99

We have Multiple hosting facilities in our Hosting Plans

So We have to do extra coding for it?

#14 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,660 posts
  • LocationMississauga, Canada

Posted 17 August 2013 - 06:35 AM

Well, your regexp pattern is wrong in that case :)

 

PS: This is a good article for beginners.


Edited by jazzman1, 17 August 2013 - 06:37 AM.


#15 oshopindia

oshopindia

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 17 August 2013 - 06:37 AM

What is regexp pattern
I Dont Know about It

Give me solution of this Issue

Edited by oshopindia, 17 August 2013 - 06:41 AM.


#16 oshopindia

oshopindia

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 17 August 2013 - 07:09 AM

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?

#17 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,660 posts
  • LocationMississauga, Canada

Posted 17 August 2013 - 07:36 AM

Yep, you should read that for sure. Don't be a lazy boy or girl ;)



#18 oshopindia

oshopindia

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 19 August 2013 - 07:04 AM

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



#19 jazzman1

jazzman1

    Advanced Member

  • Gurus
  • 2,660 posts
  • LocationMississauga, Canada

Posted 19 August 2013 - 10:46 AM

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. 



#20 oshopindia

oshopindia

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts

Posted 21 August 2013 - 12:06 AM

How can We Use apache Mod_rewrite without php






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com