jimy razit
jimy razit

Reputation: 135

Apache redirect to the exact Directory clean URL

On my website I want to make the URL looks more clean so now it looks like This

http://mywebsite.com/application/public/index.php

I want to see something cleaner just index controllers and params like this

http://mywebsite.com/index.php

Upvotes: 0

Views: 28

Answers (2)

lotfio
lotfio

Reputation: 1936

You can change your Application path from apache Like so

<Directory /yousitefolders/application/public>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
</Directory>

OR by just creating a .htaccess on your website folder normally public_html and write this:

RewriteEngine On
RewriteRule ^(.*)$ application/public/$1 [L]

Upvotes: 1

yoeunes
yoeunes

Reputation: 2945

Create a ".htaccess" file on the root directory (public_html/) and make a redirection rule like this :

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On
    RewriteRule ^(.*) application/public/$1 [L]

</IfModule>

Upvotes: 1

Related Questions