Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to turn this Lighttpd mod_rewrite to apache rewrite code.

$HTTP["host"] =~ "^(i\.ylar\.se|puush\.me)$" {
    server.document-root = "/var/www/servers/i.ylar.se/"
    url.rewrite-once = (
            "^/api/up" => "/upload.php",
            "^/([a-zA-Z0-9]+)$" => "/view.php?image=$1"
    )
}

Thanks for helping!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You probably need more than just a rewrite here...

Something like this might do it:

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName   i.ylar.se
    ServerAlias  puush.me

    DocumentRoot /var/www/servers/i.ylar.se

    RewriteEngine On

    RewriteRule ^/api/up               /upload.php [L]
    RewriteRule ^/([a-zA-Z0-9]+)$     /view.php?image=$1

</VirtualHost>
share|improve this answer
    
It seems like the VirtualHost part giving me the Error 500 Internal Server Error. I will check with my webhost if vhost is allowed/active? –  Ylar Apr 1 '13 at 15:22
    
Now I see, I can't edit the vhost settings myself.. –  Ylar Apr 1 '13 at 15:31
    
So you can't edit your server config? You're limited to what you can put in a .htaccess file? In that case you can add the rewriterules, but you can't define virtualhosts. –  Krist van Besien Apr 2 '13 at 3:42
    
I contacted the support and got the answer that I could do it in the control panel. But the rewrite stuff doesn't seem to work. –  Ylar Apr 2 '13 at 14:45
    
IF the rewrite doesn't work the first thing to do is to enable rewritelog. That way you'll see what goes on. You are putting the in a .htaccess file? If so you probably want rules that don't start with /. –  Krist van Besien Apr 2 '13 at 15:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.