RewriteEngine On
# Hide .php file extension in the urls
RewriteRule ^([^/.]+)$ $1.php
RewriteRule ^content/([A-Za-z0-9-]+)/?$ content?id=$1 [NC,L]
I'd appreciate it a ton if someone can help me find out what I am doing wrong and how I can fix this.
Thanks, Dexxterr.
With your shown samples, please try following once. Please clear browser cache before testing your URLs.
RewriteEngine On
# Hide .php file extension in the urls
RewriteRule ^([^/.]+)$ $1.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^content/([A-Za-z0-9-]+)/?$ content.php?id=$1 [NC,L]
You may need to use base tag to fix your js and other relative resources. If you are linking js files using a relative path then the file will obviously get a 404 because its looking for URL path. for example if the URL path is /file/ instead of file.html then your relative resources are loading from /file/ which is not a directory but rewritten html file. To fix this make your links absolute or use base tag. In the header of your webpage add this <base href="/">
so that your relative links can load from the correct location.