jonseg / crud-admin-generator

An open source tool to generate a complete backend from a MySql database.
http://crud-admin-generator.com/
MIT License
1.43k stars 441 forks source link

URL issue in /web/ #47

Open sarpaykent opened 9 years ago

sarpaykent commented 9 years ago

My link is like .../web/tablename but i wanna change it like .../tablename how can i do it I tried bunch of things but not even changing anythink thanks.

sarpaykent commented 9 years ago

I got this error when I redirect "../" to "../web/" http://prntscr.com/7gaso0

blag001 commented 9 years ago

As said on the Read-me, you CAN'T use a localhost/... path. You MUST use a virtual host.

You need point the document root of your virtual host to /path_to/admingenerator/web

This is an example of VirtualHost:

<VirtualHost *:80>
    DocumentRoot /path_to/admingenerator/web
    DirectoryIndex index.php
    <Directory "/path_to/admingenerator/web">
        Options Indexes FollowSymLinks
        Order Allow,Deny
        Allow from all
        AllowOverride all
        <IfModule mod_php5.c>
            php_admin_flag engine on
            php_admin_flag safe_mode off
            php_admin_value open_basedir none
        </ifModule>
    </Directory>
</VirtualHost>

You can customize the url using the .htaccess file, maybe this will help you: http://stackoverflow.com/questions/24952846/how-do-i-remove-the-web-from-my-url/24953439#24953439
blag001 commented 9 years ago

If this can help you, here is my config (Linux - ubuntu / Xampp), you'll need to adapt if you are on a windows...

/opt/lampp/etc/extra/httpd-vhosts.conf My Lampp VHost config file (with localhost, project1.local and admin.project1.local)

<VirtualHost *:80>
    DocumentRoot "/opt/lampp/htdocs/"
    ServerName localhost
    ServerAlias www.localhost
</VirtualHost>
<VirtualHost *:80>
    DocumentRoot "/opt/lampp/htdocs/www/project1"
    ServerName project1.local
    ServerAlias www.project1.local
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/opt/lampp/htdocs/www/admin_project1/web"
    DirectoryIndex index.php
    ServerName admin.project1.local
    ServerAlias www.admin.project1.local
    <Directory "/opt/lampp/htdocs/www/admin_project1/web">
        Options Indexes FollowSymLinks
        Order Allow,Deny
        Allow from all
        AllowOverride all
        <IfModule mod_php5.c>
            php_admin_flag engine on
            php_admin_flag safe_mode off
            php_admin_value open_basedir none
        </ifModule>
    </Directory>
</VirtualHost>

/opt/lampp/htdocs/www/admin_project1/web/.htaccess the HTACCESS of the crud-admin-generator

php_flag display_errors off

Options -MultiViews

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteBase /
    RewriteRule ^ index.php [QSA,L]
</IfModule>

and last : /etc/hosts (local DNS resolver that allow you to redirect your fake NDD to the local VHOST)

127.0.0.1   localhost
127.0.1.1   blag-laptop
127.0.0.1   project1.local admin.project1.local
sarpaykent commented 9 years ago

Thank you for replys! I found much easier way to do that. I'm writing here if any one wants to do that. Move "./web/index.php" to "./index.php" and "./web/.htaccess" to "./htaccess" change "./index.php" like require_once DIR.'/web/controllers/base.php';

You are done !

blag001 commented 9 years ago

You don't have any problem with resources ? (font / img) nor with the AJAX requesting ?

sarpaykent commented 9 years ago

No, because I make all them lime {{ app.asset_path }}/...