Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Redirect to custom page

Hello,

how can i redirect to a custom page.

For example:

A user calls http://www.mysite.com, but my home page is http://www.mysite.com/index. Do i have to do it in my .htaccess? Or in my Controller?.

Rgds



78.1k

its best in your nginx/apache configs if its that simple redirect.

but in controller is


$this->response->redirect("/index");

keep in mind if you using php for that redirect the whole application boots, while the other way around nothing happens :-)



32.1k
edited Jul '18

Hello Izo, thx :-)

How can i config the apache? I am using Vokuro and i have 2 .htaccess, one in root and one in public/. It is not really clear for me.

Rgds



32.1k
Accepted
answer

Yes that is clear, but i have not known it which .htaccess i have to extend it. But after some tries i did it :-)

In public/.htaccess i insert this line:

 DirectoryIndex /index

Complete:

AddDefaultCharset UTF-8

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
    DirectoryIndex /index
</IfModule>

Is that ok?

Rgds Stefan