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

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > Rewrite problem

Reply
 
Thread Tools Display Modes
  #1  
Old 03-28-2009, 05:32 PM
Kurogane Kurogane is offline
Member
 
Join Date: Mar 2009
Posts: 11
Default Rewrite problem

I have a problem with the rewrite i have this rules.

Code:
RewriteRule ^example$ /example.html
is seems the rules is ok

When i try to go www.example.net/example i got 404 error, i search in the logs i see this

[REWRITE] Rule: Match '/example' with pattern '^example$', result: -1
2009-03-28 18:11:43.479 [INFO] [x.x.x.x:2318-0#example] File not found [/home/user/example.net/example]

Code:
RewriteRule ^example(.*) example.html
[REWRITE] Rule: Match '/example' with pattern '^example(.*)', result: -1
2009-03-28 18:22:37.221 [INFO] [x.x.x.x:2912-1#example] File not found [/home/user/example.net/example]

In whatever rules always try to find this path /home/user/example.net/example of course there are not folder name example and that is why i have 404 error.

So my question is how i can fix this problem there are something wrong on my rules.

Thanks
Reply With Quote
  #2  
Old 03-29-2009, 12:53 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,585
That rewrite rule is for .htaccess, to use it at vhost level you need to add leading '/'.

RewriteRule ^/example$ /example.html
Reply With Quote
  #3  
Old 03-29-2009, 06:23 PM
Kurogane Kurogane is offline
Member
 
Join Date: Mar 2009
Posts: 11
For some reason rewrite you give me works i really sure i test that maybe cache problem anyways.

I have two question more

1. Is possible to catch all html file and convert to in www.example.net/something, for example i try this

Code:
RewriteRule ^(/.+)$         /$1.html
Is work i want, but unfortunately not all, it's convert all file in end .html in images/1.gif.html images/2.gif.html etc

2. How i can do redirect a url? i try this.

Code:
RewriteRule ^/redirect$ http://www.otherurl.com
Code:
RewriteRule ^/redirect$ /http://www.otherurl.com
and neither work for me.

Thanks for you help

Last edited by Kurogane; 03-29-2009 at 06:40 PM..
Reply With Quote
  #4  
Old 03-30-2009, 11:17 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,585
1. you need to use a regular expression only match to what you want and filter the others. like, exclude all string with "." in it.
^/([^\.]+)$

2. it should work, maybe you need to append a slash to the target URL.
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 09:41 AM.



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