ovnia
ovnia

Reputation: 2500

ZF1 Remove 'public/' from url

Using Zend_Navigation, i noticed that it's add '/public/' to all links.

How to remove this addition form url?

$navigation = array(
    array(
        'label'      => 'Home',
        'title'      => 'Go Home',
        'module'     => 'default',
        'controller' => 'index',
        'action'     => 'index',
        'route'      => 'default',
        'order'      => -100 // make sure home is the first page
    ),
    array(
        'label'      => 'Test static page!',
        'route'      => 'pages',
        'params'     => array(
            'permalink'     => 'test'
        )
    )
);
            $nav = new Zend_Navigation($navigation);

Upvotes: 0

Views: 443

Answers (3)

Thanh Nguyen
Thanh Nguyen

Reputation: 5342

Simple way I'm using:

Put index.php to the root directory.

Define APPLICATION_PATH as following:

define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application'));

Run project without public part.

Upvotes: 1

ovnia
ovnia

Reputation: 2500

The solution was simple. Edit your bootsrap.ini like this:

resources.frontController.baseUrl = "/"

Upvotes: 1

Ronak K
Ronak K

Reputation: 1567

in your .htaccess file you need to add a rule for that,

try following,

RewriteCond %{REQUEST_URI} !/public [NC]
RewriteRule ^(.*)$ public/$1 [L]

add these line in your .htaccess line, and see if it works..

or you can create a virtual host, which directly points to your public directory, as folllowing,

<VirtualHost *>
    ServerAdmin [email protected]
    DocumentRoot "C:/wamp/www/project/public"
    ServerName localhost.test
    ServerAlias localhost.test
    <Directory "C:/wamp/www/project/public">   
        DirectoryIndex index.php      
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

you need to follow somethings first in order to create a vhost.

OFFICIAL DOC FOR VIRTUAL HOST

Upvotes: 0

Related Questions