Welcome Guest, Not a member yet? Register   Sign In
.htaccess question: 404 Results from Different Paths on Server vs. Localhost?
#1

I'm moving my app to a new web host and have to resolve some questions about pathing.

On my localhost dev environment, everything is working. Here is the folder layout:


Quote:Root Directory 
--System Folder
--Application Folder
--etc.


Here is the folder layout on my web host:


Quote:Root Directory
--xyz folder
----System Folder
----Application Folder
----etc.


If I visit the following URL in my browser, I get a 404 error:


Quote:http://myDomainName/xyz


Is there a way to correct this via .htaccess?

Thanks very much in advance to all for any 
Reply
#2

Is the 404 from codeigniter or from the webserver?
Reply
#3

Thanks for the reply, Paradinight.  I solved this. There were two things I had to do. First I had to move my .htaccess file into the folder that contained index.php. Next, I had to edit config.php and change:

PHP Code:
$config['url_suffix'] = "html"

to

PHP Code:
$config['url_suffix'] = ""

On my previous web host this was fine, but on this new web host (Dreamhost), a url_suffix of "html" appears to break the app.
Reply
#4

(This post was last modified: 08-23-2015, 09:37 PM by phplaw.)

The problem is because of  you dont have file .htaccess in xyz or you have but It only works on root directory, please read document guide or search google for creating .htaccess for Codeigniter,
then you will find some articles about creating, configuration for that file, place It in /xyz/ folder, then You have to modify your .htaccess file to run CI from any directory (include subdirectories)
FROM:
Code:
RewriteRule ^(.*)$ /index.php/$1

TO:

Code:
RewriteRule ^(.*)$ ./index.php/$1

If you follow my instruction then I think you will be ok.
Another way is add index.php in your url
http://myDomainName/xyz/index.php
http://myDomainName/xyz/index.php/controller_name/
http://myDomainName/xyz/index.php/controller_name/action_name
http://myDomainName/xyz/index.php/controller_name/action_name/parameters_etc
P/S: make sure mod rewrite (htaccess) has been turned on your server.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB