LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > Rewrite all 404s

Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2013, 04:45 AM
techieanalyst techieanalyst is offline
New Member
 
Join Date: Dec 2012
Posts: 7
Default Rewrite all 404s

Im running IPBoards 3.4.2 and I need this problem solved and they've already pretty much pointed at the webserver

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(jpeg|jpg|gif|png)$ /public/404.php [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

All sites come back as 404, what should I set on my listener/server side in the GUI to make this work
Reply With Quote
  #2  
Old 01-29-2013, 10:09 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,338
Quote:
Originally Posted by techieanalyst View Post
Im running IPBoards 3.4.2 and I need this problem solved and they've already pretty much pointed at the webserver

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(jpeg|jpg|gif|png)$ /public/404.php [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

All sites come back as 404, what should I set on my listener/server side in the GUI to make this work
enable rewrite logging (Add 'RewriteLogLevel 9' in vhost section of httpd.conf) and grep 'REWRITE' entries from /usr/local/apache/logs/error_log to see what is going on.
Reply With Quote
  #3  
Old 01-30-2013, 06:31 AM
techieanalyst techieanalyst is offline
New Member
 
Join Date: Dec 2012
Posts: 7
The only httpd.conf found on my server was at

/usr/local/lsws/add-ons/frontpage/conf

Its totally empty

Apache has never been installed on the server, this is a dedicated server I put together myself
Reply With Quote
  #4  
Old 01-30-2013, 06:39 AM
techieanalyst techieanalyst is offline
New Member
 
Join Date: Dec 2012
Posts: 7
These are the errors Im getting with the log level set to 9

2013-01-30 10:36:12.740 [INFO] [10.1.1.156:50369-4#Techie] [REWRITE] Rule: Match '/forums/' with pattern '\.(jpeg|jpg|gif|png)$', result: -1
2013-01-30 10:36:12.740 [INFO] [10.1.1.156:50369-4#Techie] [REWRITE] Rule: Match '/forums/' with pattern '.', result: 1
2013-01-30 10:36:12.740 [INFO] [10.1.1.156:50369-4#Techie] [REWRITE] stat( /usr/local/lsws/DEFAULT/html/forums ) failed
2013-01-30 10:36:12.740 [INFO] [10.1.1.156:50369-4#Techie] [REWRITE] stat( /usr/local/lsws/DEFAULT/html/forums ) failed
2013-01-30 10:36:12.740 [INFO] [10.1.1.156:50369-4#Techie] [REWRITE] Source URI: '/forums/' => Result URI: '/index.php'
2013-01-30 10:36:12.740 [INFO] [10.1.1.156:50369-4#Techie] [REWRITE] Last Rule, stop!
2013-01-30 10:36:12.836 [INFO] [10.1.1.156:50369-5#Techie] [REWRITE] Rule: Match '/forums' with pattern '\.(jpeg|jpg|gif|png)$', result: -1
2013-01-30 10:36:12.836 [INFO] [10.1.1.156:50369-5#Techie] [REWRITE] Rule: Match '/forums' with pattern '.', result: 1
2013-01-30 10:36:12.836 [INFO] [10.1.1.156:50369-5#Techie] [REWRITE] stat( /usr/local/lsws/DEFAULT/html/forums ) failed
2013-01-30 10:36:12.836 [INFO] [10.1.1.156:50369-5#Techie] [REWRITE] stat( /usr/local/lsws/DEFAULT/html/forums ) failed
2013-01-30 10:36:12.836 [INFO] [10.1.1.156:50369-5#Techie] [REWRITE] Source URI: '/forums' => Result URI: '/index.php'
2013-01-30 10:36:12.836 [INFO] [10.1.1.156:50369-5#Techie] [REWRITE] Last Rule, stop!
Reply With Quote
  #5  
Old 01-30-2013, 11:15 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,338
looks like native LSWS vhost setup. are you able to request a simple phpinfo page?
Reply With Quote
  #6  
Old 01-30-2013, 11:29 AM
techieanalyst techieanalyst is offline
New Member
 
Join Date: Dec 2012
Posts: 7
like any php?

You thinking PHP mod rewrite isn't enabled maybe?
Reply With Quote
  #7  
Old 01-30-2013, 11:32 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,338
Quote:
Originally Posted by techieanalyst View Post
like any php?

You thinking PHP mod rewrite isn't enabled maybe?
mod_rewrite is working as shown in the rewrite log. but not sure if php is working properly.
Reply With Quote
  #8  
Old 02-23-2013, 09:33 AM
danse danse is offline
New Member
 
Join Date: Feb 2013
Posts: 3
v4.2.2, native litespeed server and vhost config.

seems like the same problem i get.

first of all the rewrite rules (joomla default rewrite rules):
Code:
RewriteEngine On

RewriteCond &#37;{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond &#37;{QUERY_STRING} (<|&#37;3C)([^s]*s)+cript.*(>|&#37;3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule .* index.php [F]

RewriteBase /base/

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
now to the interesting parts. if i use .htaccess the rewrite rules work. if i use litespeed nativ rewrite settings under virtual hosts -> rewrite the rules result in 404s.

Quote:
Originally Posted by htaccess
==> /srv/http/test/logs/error.log <==
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] strip base: '/base/' from URI: '/base/features'
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] Rule: Match 'features' with pattern '.*', result: 1
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] Cond: Match '' with pattern 'base64_encode[^(]*\([^)]*\)', result: -1
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] Cond: Match '' with pattern '(<|%3C)([^s]*s)+cript.*(>|%3E)', result: -1
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] Cond: Match '' with pattern 'GLOBALS(=|\[|\%[0-9A-Z]{0,2})', result: -1
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] Cond: Match '' with pattern '_REQUEST(=|\[|\%[0-9A-Z]{0,2})', result: -1
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] Rule: Match 'features' with pattern '.*', result: 1
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] add ENV: 'HTTP_AUTHORIZATION:'
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] No substition
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] Rule: Match 'features' with pattern '.*', result: 1
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] Cond: Match '/base/features' with pattern '^/index\.php', result: -1
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] Cond: Match '/base/features' with pattern '/component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$', result: 2
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] stat( /srv/http/test/www/base/features ) failed
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] stat( /srv/http/test/www/base/features ) failed
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] Source URI: 'features' => Result URI: 'index.php'
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] Last Rule, stop!
2013-02-23 18:11:57.439 [INFO] [12.34.56.78:52161-0#test] [REWRITE] prepend rewrite base: '/base/', final URI: '/base/index.php'

==> /srv/http/test/logs/access.log <==
12.34.56.78 - - [23/Feb/2013:18:11:57 +0100] "GET /base/features HTTP/1.1" 200 4578
Quote:
Originally Posted by litespeed setting
==> /srv/http/test/logs/error.log <==
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] Rule: Match '/base/features' with pattern '.*', result: 1
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] Cond: Match '' with pattern 'base64_encode[^(]*\([^)]*\)', result: -1
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] Cond: Match '' with pattern '(<|%3C)([^s]*s)+cript.*(>|%3E)', result: -1
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] Cond: Match '' with pattern 'GLOBALS(=|\[|\%[0-9A-Z]{0,2})', result: -1
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] Cond: Match '' with pattern '_REQUEST(=|\[|\%[0-9A-Z]{0,2})', result: -1
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] Rule: Match '/base/features' with pattern '.*', result: 1
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] add ENV: 'HTTP_AUTHORIZATION:'
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] No substition
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] Rule: Match '/base/features' with pattern '.*', result: 1
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] Cond: Match '/base/features' with pattern '^/index\.php', result: -1
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] Cond: Match '/base/features' with pattern '/component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$', result: 2
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] stat( /srv/http/test/www/base/features ) failed
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] stat( /srv/http/test/www/base/features ) failed
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] Source URI: '/base/features' => Result URI: 'index.php'
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] [REWRITE] Last Rule, stop!
2013-02-23 18:23:51.277 [INFO] [12.34.56.78:52283-0#test] File not found [/srv/http/test/www/index.php]

==> /srv/http/test/logs/access.log <==
12.34.56.78 - - [23/Feb/2013:18:23:51 +0100] "GET /base/features HTTP/1.1" 404 389
the only difference i can spot are the lines with "strip base" and "prepend write base" in the htaccess log.

Any ideas what i'm doing wrong?

Last edited by danse; 02-23-2013 at 09:55 AM..
Reply With Quote
  #9  
Old 02-23-2013, 08:41 PM
NiteWave NiteWave is online now
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,226
Code:
now to the interesting parts. if i use .htaccess the rewrite rules work. if i use litespeed nativ rewrite settings under virtual hosts -> rewrite the rules result in 404s.
it's difference between per-server and per-directory rewriterule.

refer apache document:
http://httpd.apache.org/docs/current...d_rewrite.html

for these rules, I think

RewriteRule .* index.php [F] --> RewriteRule .* /base/index.php [F]
RewriteRule .* index.php [L] --> RewriteRule .* /base/index.php [L]

and comment out
#RewriteBase /base/

should work under virtual host
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:59 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.