Mobile app version of vmapp.org
Login or Join
Sims2060225

: Modify .htaccess to allow existing files without extension to be served I have the following .htaccess: #If the requested URI does not end with an extension OR if the URI ends with .php* #(where

@Sims2060225

Posted in: #Apache #Htaccess

I have the following .htaccess:
#If the requested URI does not end with an extension OR if the URI ends with .php*
#(where * is optionally one or more numbers)
RewriteCond %{REQUEST_URI} !.[^/]+$ [NC,OR]
RewriteCond %{REQUEST_URI} .php[s0-9]*$ [NC]
#Then serve the URI via the mapper
RewriteRule .* /mapper.php?uri=%{REQUEST_URI} [L,QSA]


I would like to add the following conditions to it:


The file actually exists
And is without an extension


So the entire file would do something like this:

IF (requested URI does not end with an extension) OR (URI ends with .php*) THEN
rewrite the URI
END

IF (file exists) AND (file requested does not end with an extension)
rewrite the URI
END

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sims2060225

1 Comments

Sorted by latest first Latest Oldest Best

 

@Lee4591628

Perhaps something like this:

RewriteCond %{REQUEST_FILENAME} -s
RewriteCond %{REQUEST_URI} .php[s0-9]*$ [NC]
RewriteRule .* /mapper.php?uri=%{REQUEST_URI} [L,QSA]

RewriteCond %{REQUEST_FILENAME} -s
RewriteCond %{REQUEST_URI} !.[^/]+$ [NC]
RewriteRule .* /mapper.php?uri=%{REQUEST_URI} [L,QSA]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme