Redirecting improperly when using the htaccess file in the nette package

Notice: This thread is very old.
HosipLan
Moderator | 4668
+
0
-

You should show us your .htacces and routing setup (that means probably app/bootstrap.php), we can't help you otherwise. And please use proper code formating.

Last edited by HosipLan (2012-09-02 22:25)

petr.pavel
Member | 535
+
0
-

The redirection to www.localhost is caused by the part commented as “# presmerovani na www”. This has nothing to do with Nette. It appears you need to learn more about mod_rewrite.

If you want to access the app using http://localhost you'll have to add another RewriteCond that excludes localhost. Personally though, I prefer using fake domain names on my development server. That way I get as close as possible to the live server, and I can test even non-www to www redirection.

Re “error 500 while going to some links”: Please be more specific.

Last edited by petr.pavel (2012-09-03 10:49)

petr.pavel
Member | 535
+
0
-

I see that the 500 error is served by Nette. Have a look into the log directory for details on what caused it.

blacksun
Member | 177
+
0
-

Try exchanging

# presmerovani na www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

to this

# presmerovani na www
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} !^localhost
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]