Jump to content


Photo

.htaccess not working for rewrite rules


Best Answer Ch0cu3r, 08 July 2014 - 04:36 PM

 

 

but the url didnt change like it should have in the rewrite rule.

That is not how mod_rewrite works. It does not change links for you.

 

You need to change all links in your code to  view/inventory.php  to  product/

<a href="/product/">View Inventory</a>

mod_rewite will then map site.com/product/ to site.com/view/inventory.php

Go to the full post


  • Please log in to reply
1 reply to this topic

#1 echosara

echosara

    Member

  • Members
  • PipPip
  • 10 posts

Posted 08 July 2014 - 03:37 PM

Hi,

can anyone tell me what im doing wrong. below is a rewrite rule saved as .htaccess. the page loads and i dont get a 500 error but the url didnt change like it should have in the rewrite rule. The .htaccess is located in the root folder. Any idea what i'm doing wrong guys?
 

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^products/$ view/inventory.php

</IfModule>



#2 Ch0cu3r

Ch0cu3r

    Advanced Member

  • Moderators
  • 2,303 posts

Posted 08 July 2014 - 04:36 PM   Best Answer

 

 

but the url didnt change like it should have in the rewrite rule.

That is not how mod_rewrite works. It does not change links for you.

 

You need to change all links in your code to  view/inventory.php  to  product/

<a href="/product/">View Inventory</a>

mod_rewite will then map site.com/product/ to site.com/view/inventory.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