Working with .htaccess – php

Check to make sure you have mod_rewrite enabled.

  • Find the httpd.conf file (C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf)
  • Inside the httpd.conf file uncomment the line LoadModule rewrite_module modules/mod_rewrite.so (remove the pound ‘#’ sign from in front of the line)
  • Also find the line ClearModuleList is uncommented then find and make sure that the line AddModule mod_rewrite.c is not commented out.

If the LoadModule rewrite_module modules/mod_rewrite.so line is missing from the httpd.conf file entirely, just add it.

References
https://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

Sample

RewriteEngine on

# map neat URL to internal URL
RewriteRule ^mobile/list/$ RestController.php?view=all [NC,L]
RewriteRule ^mobile/list/([0-9]+)/$ RestController.php?view=single&id=$1 [nc,qsa]
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s