My .htaccess sends all page requests to the index.php - I am stripping the extension off filenames, so, all of my URL’s are like www.abc.com/about/ instead of www.abc.com/about.php
The issue I am having is that it appears that with this, it is fooling either the script or the webserver thinking we’re in a different directory, so, although the content loads fine (the page content) items like the stylesheet which is embeded and images do not load. On closer inspection, it is now looking for the stylesheet in abc.com/about/style/main.css instead of abc.com/style/main.css - I really have NO IDEA where to look and my .htaccess knowledge is EXTREMELY limited.
I have attached below the rewriteconditions and rule and also the embedded url so that you can have a look at what I am doing wrong
# Rewrite all filenames to mod rewrite filenames
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [NC,L]
// AND THE STYLE:
<link rel="stylesheet" href="css/main.css" media="all" />
I would obviously like to avoid using full url’s like www.abc.com/css/main.css when embedding content, so any help will greatly be appreciated
This is kind of off topic, so apologies for that, but an easier way to have URLs like mysite.com/about/ is to have an /about/ folder with an index.php file in it. That’s probably easier than having to set up Apache redirects. (It wouldn’t help with the CSS files, but that doesn’t really matter, as those links aren’t really public anyway.) Just thought I’d mention this anyway.
Thanks for your reply. In principle I understand this and see the proposed solution, however, its not really a consistant solution for long term growth of a project. Whats just very frustrating is that one knows its possible, yet, there is so little resources which can effectively help you.
It almost feels like each project has his own htaccess devils and getting past it is a nightmare. Anyways thanks for your proposed solution, but I hope someone else can assist here as well