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

I can't find out anything go wrong.

appendix with 00-default

AccessFileName .htaccess
Alias /api "/var/www/AppServices/public"
Alias /server_api "/var/www/AppServices/Server_API"
Alias /client_api "/var/www/AppServices/Client_API"
Alias /secure_api "/var/www/AppServices/Secure_API"

Listen 8002
<VirtualHost *:8002>
    DocumentRoot /var/www/AppServices/public
    ServerName .local

    # This should be omitted in the production environment
    SetEnv APPLICATION_ENV development
    <Directory "/var/www/AppServices/public">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
    </Directory>

</VirtualHost>

.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond %{REQUEST_FILENAME} !-s [OR]
RewriteRule ^(.*)$ index.php?request=$1 [QSA,NC,L]

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ index.php [NC,L]

RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^(.*)$ index.php [NC,L]
</IfModule>

. the index.php is under the folder.

/var/www/AppServices/Server_API$ ls
.  ..  admin.php  .htaccess  index.php  infor.php  message.php

When I POST JSON to this url

xxx.xxx.xxx.xxx:8002/server_api/message

I got 404 error:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /var/www/AppServices/Server_API/index.php was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at xxx.xxx.xxx.xxx Port 8002</address>
</body></html>

It looks like the .htaccess file under the same folder is working. It translate url "http://xxx.xxx.xxx.xxx:8002/server_api/message" to "http://xxx.xxx.xxx.xxx:8002/server_api/index.php?request=message". But the apache2 can't find out the index.php in the same folder.

- Edit -

in the Apache2 error.log :

[Sun Apr 14 21:08:17 2013] [error] [client 127.0.0.1] File does not exist: /var/www/AppServices/public/var

there is no var in the public folder. But why????

share|improve this question
    
What are the access and error log showing? It might just be a filesystem permission issue. –  Krist van Besien Apr 15 '13 at 7:42
    
I can't understand why apache2 tried to find out "var" folder/file. I moved configuration from Windows... It was fine on Windows. –  Robert Yi Jiang Apr 15 '13 at 8:12
    
Could you please check the case in your samples and directory structure ? One big difference between Windows and Unix file system is that unix's is case sensitive: Server_API is different from server_api. If you mix the case in your request on a windows system, it will work but it'll give you a 404 on *nix –  Stephane Apr 15 '13 at 8:25
    
I will try it tonight. Thank you :D –  Robert Yi Jiang Apr 19 '13 at 4:12

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.