Frage

Currently I am developing a webshop in PHP. For this I use the Zend Framework 2.

All of my routes exist of a locale i.e. "nl_NL" or "en_EN", followed by a controller and an action www.mydomain.com/nl_NL/profile/login. Look here for an example of a route used in my project. This one belongs to the Profile Module: http://pastebin.com/jmim47w8.

If the visitor has no account, and no Cookie is set, the locale variable will first be set to the variable retrieved from the following function:

locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE'])

If a cookie is set that value will be used. On the other hand, if a user does have an account and is logged in, the variable used will be retrieved from the user's profile.

My entire script does work on a localhost. However, on the server it doesn't. When loading the page nothing gets shown. I have checked the error logs and couldn't find anything. However, when i place /nl_NL/ or any other locale that meets the requirements of the "locale route" regex in the url manually, it does work.

My first thought was that the url_rewrite apache module was not installed or activated, but since other websites use this module as well, and they are on the same server this doesn't seem logical. Of course I did try to check wether it was enabled by running some scripts, but to no avail. Since our server is setup to not allow shell scripts to be ran, or to check wether apache modules are enabled using phpinfo() it's quite hard to make sure.

I have tried to verify that my .htaccess file is correct, but I'm pretty much a noob at .htaccess. This is my .htaccess:

RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The 
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to 
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size 
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]

To see what my IndexController looks like look here: http://pastebin.com/AEgm3Jmk.

All in all, I would really like to know how to get a Zend FW 2 project to work on a hosting server while still using url rewrite or any other way that makes it possible to use locale variables.

If there is something missing from this post that is needed to help me further, I will be happy to post it.

War es hilfreich?

Lösung

I have solved the problem, everything is working fine right now. I found the problem to be in my local.php config file. The problem was an error within this file, so it was actually a write error ( corrupt file ).

@Alex thanks for the help though, appreciate it.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top