Alright so this is what the root of my site looks like:
- assets
- css
- js
- img
- .htaccess
- index.php
- page1.php
- page2.php
- page3.php
- style.css
My current .htaccess file works in the sense that it hides .php from the pages which is what i want. So i can access it from http://example.com/page2. But the problem is if i go to http://example.com/page2/ You can see the raw code without any CSS. I want to either redirect users to somewhere else OR have it show it correctly regardless of if there is a "/" or not.
Making it a directory is not an option. It has to be a PHP file in the root.
Current .htaccess file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
/; does/page2/definitely displaypage2.php, or is it some other content? The reason the CSS isn't displaying correctly is thathref="style.css"means "a file called 'style.css' in the current URL directory; to the browser, the directory ishttp://example.com/page2/nothttp://example.com/, as it doesn't know about the rewrite rules. You just need to use a path relative to the domain root instead:href="/style.css".