Search code examples
.htaccessmod-rewriteoxwall

Oxwall htaccess removing extension on loose php file and ignore index.php rewrite


I am trying to create a loose page on my oxwall website.

The standard htaccess of oxwall is like this:

Options +FollowSymLinks
RewriteEngine On

AddEncoding gzip .gz
AddEncoding gzip .gzip
<FilesMatch "\.(js.gz|js.gzip)$">
  ForceType text/javascript
</FilesMatch>
<FilesMatch "\.(css.gz|css.gzip)$">
  ForceType text/css
</FilesMatch>


RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} !/ow_updates/index\.php
RewriteCond %{REQUEST_URI} !/ow_updates/
RewriteCond %{REQUEST_URI} !/ow_cron/run\.php
RewriteCond %{REQUEST_URI} !/e500\.php
RewriteCond %{REQUEST_URI} !/captcha\.php

#RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$  [NC]
RewriteCond %{REQUEST_FILENAME} (/|\.php|\.html|\.htm|\.xml|\.feed|robots\.txt|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php

Now i have a file, file.php, placed in the root of my website. I want to be able to access this file like this: http://www.website.com/test

I have been able to exclude the file from the rewriterule with this:

RewriteCond %{REQUEST_URI} !/test.php

So now i could access my file like this: http://www.website.com/test.php

Or i've been able to remove the extension like this:

RewriteRule ^test test.php

Now if i do this, the real index wont load properly anymore.

Does anyone know what i'm doing wrong. Or do you have a different solution i can use?

Thanks, Robin


Solution

  • Solved by creating a folder called test and adding index.php in this folder

    htaccess code used is RewriteCond %{REQUEST_URI} !/test/ before the final rule So now my url to this page is http://www.website.com/test

    One simple solution for this hours of waste

    Cheers