Rewrite problem

Discussion in 'Install/Configuration' started by Kurogane, Mar 29, 2009.

  1. Kurogane

    Kurogane Member

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

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

    When i try to go 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/]

    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/]

    In whatever rules always try to find this path /home/user/ 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.

  2. mistwang

    mistwang LiteSpeed Staff

    That rewrite rule is for .htaccess, to use it at vhost level you need to add leading '/'.

    RewriteRule ^/example$ /example.html
  3. Kurogane

    Kurogane Member

    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, for example i try this

    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.

    RewriteRule ^/redirect$
    RewriteRule ^/redirect$ /
    and neither work for me.

    Thanks for you help
    Last edited: Mar 30, 2009
  4. mistwang

    mistwang LiteSpeed Staff

    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.

Share This Page