PHP mod rewrite .htaccess file godaddy.com question

501

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?

91

Answer

Solution:

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

A note, though, goDaddy normally requiresRewriteBase /

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 

People are also looking for solutions to the problem: How can I overlay a watermark on an already resampled image in PHP (using GD)?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.