[Solved] How to rewrite URLs for readability [closed]


In your .htaccess file make sure you have

RewriteEngine on and do the following:

RewriteRule ^image/([0-9]+)$ image.php?id=$1 [L]

For instance:

RewriteEngine on

RewriteRule ^image/([0-9]+)$ image.php?id=$1 [L]

This is assuming you’re running a webserver that can handle .htaccess – you may also need to enable mod_rewrite

Enabling this is dependent on the webserver you’re running, if it’s apache2 you could do

a2enmod rewrite

and service apache2 restart

in your terminal.

If you’re unsure if it is enabled or not; you can do

<?php
phpinfo();
?>

and look for mod_rewrite

2

solved How to rewrite URLs for readability [closed]