I'm trying to use pretty URLs on my site, and I don't know too much about htaccess, but after some search I ended up with this:
RewriteEngine On
RewriteRule ^([a-z]+)\/([0-9]+)\/?$ content.php?action=$1&id=$2 [NC]
I'm trying to change this:
mysite.com/cms/content.php?action=content&id=80
into:
mysite.com/cms/content/80
But somehow it's not working and what I get is a blank screen and a 404 error,
Failed to load resource: the server responded with a status of 404 (Not Found) --in-- /cms/files/plugin/tinymce/tinymce.min.js
About the 404 error: It should load a .js file from mystie.com/files/plugin/tinymce/tinymce.min.js -- not -- mystie.com/cms/files/plugin/tinymce/tinymce.min.js
My htaccess file is in the root folder. Am I doing something wrong?
I think the server did not read my .htaccess file. How do I find out the issue?
You need to place this rule in /cms/.htaccess
:
RewriteEngine On
RewriteBase /cms/
RewriteRule ^([a-z]+)/([0-9]+)/?$ content.php?action=$1&id=$2 [NC,L,QSA]
Then you need add this in the <head>
section of your page's HTML: <base href="/" />
so that every relative URL is resolved from that URL and not the current page's relative URL.