How to delete a directory ONLY IF

Hi, im trying to make this URL:
http://example.com/pages/something.php

TO
http://example.com/something

I get it with this:

RewriteCond %{REQUEST_URI} !^/pages/
RewriteRule ^(.*)$ /pages/$1

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php

But i have two errors:

  1. I cant access to index.php (in root directory)
  2. When i open any file in pages directory (with the new URL) it loads but the styles, images and everything else doesn’t because, for example: if the style path is …css/main.css it’s requesting …/pages/css/main.css

Any idea? (srry for my bad english)

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.