Jump to content

mod-rewrite has no effect


wright67uk

Recommended Posts

I'm using an .htaccess file but it has no effect.  I'm using godaddy for my hosting.

 

#mod_rewrite
#RewriteBase /
 
#Fix Rewrite
Options -Multiviews
 
RewriteEngine on
RewriteBase /
Options +FollowSymLinks
 
RewriteRule ^C_(.*)$ cat.php?type=$1 [L]
RewriteRule ^P_(.*)$ product_info.php?name=$1 [L]
 
Im trying to make it so if anyone were for an example to click on a link:  
 
1pw.co.uk/product_info.php?name=namehere
 
it would display in the browser as
 
1pw.co.uk/P_namehere
 
at the moment everything is as it were before i even added the file.  Where am i going wrong?
Link to comment
https://forums.phpfreaks.com/topic/294767-mod-rewrite-has-no-effect/
Share on other sites

Ok thankyou, I understand how this works now.

Can I change this so that instead of

http://www.1pw.co.uk/C_Shrubs

I can have

http://www.1pw.co.uk/shrubs

 

And instead of

http://www.1pw.co.uk/P_AMELANCHIER%20CANADENSIS

I can have

http://www.1pw.co.uk/amalanchier_canadensis

?

Thanks for your help on this :-)

Yes you can but then mod rewrite will not know which rewriterule will apply to those urls (for example it will not know that /shrubs should go to the rewriterule for cat.php or /amalanchier_canadensis should go to the rewriterule for product_info.php).

 

It currently only knows which rewriterule applies due to the the  C_ and P_ prefixes. If you don't like the C_ and P_ prefixes then maybe change your urls to something like

site.com/category/shrubs

site.com/product/amalanchier_canadensis

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.