Hi I want to rewrite my site URLs. Now I am using PHP 5 for development. I tried with the following .htaccess.
RewriteEngine on
RewriteRule ^(.*)/(.*).html$ $1.php?code=$2 [L]
RewriteRule ^(.*).html$ $1.php [L]
The URL without argument is working, but the first one shows some problems. It redirects to the page, but the page styles are missing whatever value I pass for code.
Why is it happening? Is there any option for rewriting URLs using PHP5?
If you redirect to ‘folder/file.html’ all of your relative links will be messed up. It will be looking for ‘css/style.css’ in ‘folder/css/style.css’ instead.
You can either use absolute links i.e. ‘www.example.com/css/style.css’ or rewrite your link paths as well.