max
max

Reputation: 43

PHP mod rewrite .htaccess file godaddy.com question

I'm new to PHP and i was trying to learn mod rewrite to rewrite my URLs i use godaddy as my hosting company and they say to add the desired code to the body of your .htaccess file how do I mod rewrite my URLs and add it to my .htaccess file?

Can some one give me an example of how to do this as well as point me to a good tutorial and or book on how to mod rewrite my URLs?

Upvotes: 4

Views: 521

Answers (1)

Dan Heberden
Dan Heberden

Reputation: 11068

http://articles.sitepoint.com/article/guide-url-rewriting

A note, though, goDaddy normally requires RewriteBase /

Quick 'n dirty

RewriteEngine On
RewriteBase /
RewriteRule ^/?about/?$ about.php [L,NC,QSA] # domain.com/about is sent to the server as domain.com/about.php
RewriteRule ^/products/([0-9]+)$ /products.php?id=$1 [L,NC,QSA]  # domain.com/products/23 is sent to the server as domain.com/products.php?id=23 

Upvotes: 3

Related Questions