Rewrite problem

#1
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
 
#3
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:

mistwang

LiteSpeed Staff
#4
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.
 
Top