[solved] Alternative to Multiveiws

#1
Hi

My host has changed to Litespeed from Apache but I am having trouble with my site now.

I have used the basic rewrite rule found on this forum and that works great for certain URL's and not so great for others.

# Multiviews
RewriteEngine On
RewriteCond %{REQUEST_URI} !.+php*
RewriteCond %{DOCUMENT_ROOT}/$1\.php -f
RewriteRule ^([^/]+)/?(.*)$ $1.php/$2 [L]

But problem I am having is that works great on this

http://www.best-butcher.co.uk/butcher-details/test/1

but when it comes to

http://www.best-butcher.co.uk/cp/rate-butcher/test/1

Or any file in the cp directory that does not contain the file extension.

It wont work for some reason. Can anybody help me out with this issue please?
 
Last edited by a moderator:

webizen

Well-Known Member
#2
is the last part (i.e. test/1) always the parameters to the php script (i.e. butcher-details(.php) and rate-butcher(.php)) prior to that? there can be 0 (/) or multiple level directories (/cp/..), correct? if so, try something like the following: %

RewriteEngine On
RewriteCond %{REQUEST_URI} !.+php*
RewriteCond %{DOCUMENT_ROOT}/$1\.php -f
RewriteRule ^(.+)/(.+/.+)$ $1.php/$2 [L]
 
Last edited:
#3
Thats worked great cheers but has made these types of URL stop working.

http://www.best-butcher.co.uk/find-butcher
EDIT (now working just added the old rewrite and using both your suggested one and the old one together)

And also have urls like this not working.

http://www.best-butcher.co.uk/cp/find-butcher
EDIT (still not working)

These work ok if I add the .php to the end as thats what the file is really called but of course have designed the site to work without file extensions and thats why this issue has come up.

On Apache of course just turned multiveiws on and this was fine but now the hosting company has changed to Litespeed am having issues.

Cheers
John
 
Last edited:

NiteWave

Administrator
#4
how about copy following rules to each sub folder's .htaccess which need multiviews?

# Multiviews
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.php$
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)(/?)(.*)$ $1.php$2$3 [L]
 
Top