0

I have php files on my local server.

First file is: sanjeev-kapoor.php Second file is: product-sub.php

What I am trying to achieve through .htaccess file is, when a user hits in URL http://mywebsite.com/sanjeev-kapoor.html it should process the page http://mywebsite.com/sanjeev-kapoor.php

And when user hits this url: http://mywebsite.com/product/sanjeev-kapoor/tea-set.html

It should process and show this page: http://mywebsite.com/product-sub.php??mid=firstQueryParam&series=secondQueryParam [L]

Here is my htaccess file content:

<IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteRule ^/sanjeev-kapoor.html /sanjeev-kapoor.php [L] RewriteRule ^/?product/(.*)/([^/]+).html /product-sub.php?mid=$1&series=$2 [L] </IfModule> 

But its not working. It always shows me 404 Not found error. The requested URL /site/product/sanjeev-kapoor/tea-set.html was not found on this server.

I made it sure that "Override all" is there and require all granted is there in my .httpdconf file. Also, the rewrite module is enabled in my config file.

Please help.

5
  • Possible duplicate of Htaccess Removing .php extension to .html make an URL Not found Commented Nov 15, 2016 at 9:31
  • the link you mentioned redirects every html file to php. while I am having issue about passing query string in url along with html to php rewrite Commented Nov 15, 2016 at 11:09
  • Yes, you're not using the exact same URLs. But you look at those rules and apply the knowledge to yours. Commented Nov 15, 2016 at 11:23
  • Solved it the other way. The link you marked dupicate didnt help me. Thanks Commented Nov 16, 2016 at 4:54
  • So post your solution as an answer. Commented Nov 16, 2016 at 5:58

0