user2534723
user2534723

Reputation: 125

PHP Files/Directories - .htaccess

Alright so this is what the root of my site looks like:

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]

Upvotes: 0

Views: 278

Answers (1)

Jon Lin
Jon Lin

Reputation: 143856

Change your css links to absolute URLs (the start with a /) or add this to the header of your pages:

<base href="/">

Upvotes: 1

Related Questions