1

I have a core php application which works perfectly locally. My issues started once try to host it live in a hosting server.

The website folder structure is such that the userlogin.php ( index/default page ) is inside admin folder.

It was showing 403 permission error if just pushing the files exactly like the local host works. So added .htaccess file with the following content,

Options +FollowSymLinks

DirectoryIndex userlogin.php

So finally the login page appears, but need to access the url like www.sample.com/admin/ but what I need is to load default page through url www.sample.com without /admin.

I searched related SO questions related and tried but didn't work link2

Link1

One more thing related to Undefined index:

Tried to comparing the local and server sourcecode and found it exactly the same. Has it something to do with the redirecting or .htaccess?

Do we need to follow things while moving the code from local to online server like Godaddy?

Please don't mark as duplicate as there are few questions that might look similar but those didn't solve the issue.

Thanks in advance.

Community
  • 1
  • 1
user2695433
  • 2,013
  • 4
  • 25
  • 44

1 Answers1

0

You can use this code to load /admin/ when using base URL:

Options +FollowSymLinks
DirectoryIndex userlogin.php 

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !^admin/ admin%{REQUEST_URI} [L,NC]
anubhava
  • 761,203
  • 64
  • 569
  • 643