C A
C A

Reputation: 107

How to change default directory access for a web app?

Currently when I open the main URL xyz.com of my web app, it takes the web app to xyz.com/abc/index.php.

I have another directory called 'ghi' in addition to 'abc' in my web app.

I want the web app to open with xyz.com/ghi/index.php instead of xyz.com/abc/index.php.

How do I achieve this so that upon entering xyz.com in a browser, the web app is taken to xyz.com/ghi/index.php instead of xyz.com/abc/index.php?

Upvotes: 0

Views: 44

Answers (3)

DonkeyKong
DonkeyKong

Reputation: 818

I think you can (and should) achive this goal with using a .htaccess file.. Here is a sample generated via this tool

//Rewrite to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com/ghi/index.php[nc]
RewriteRule ^(.*)$ http://www.example.com/ghi/index.php/$1 [r=301,nc]

Hope this helps..

Upvotes: 0

Karthick Kumar
Karthick Kumar

Reputation: 2361

simply ,place it as the first line after in index.php file

 header('location:xyz.com/ghi/index.php');

or else Cpanel and redirect to the URL

Upvotes: 0

C A
C A

Reputation: 107

Create a file index.php inside xyz directory with following code:

<html>
 <a href="/ghi">Click Here</a>
</html>

Upvotes: -1

Related Questions