I referred the CodeIgniter Site and also checked various sites for information on how to remove index.php file from Mac OS X 10.10. But still index.php is unavoidable. I need steps to remove index.php from CodeIgniter on Mac OS 10.10.
This is working:
localhost/jenny/Learn/index.php/about
This is not working:
localhost/jenny/Learn/about
As long as you are running apache the operating system should not make a difference in this case.
You need to create a .htaccess file within the your root web directory (this is the directory where the index.php file is located) and within the .htaccess file you will want to include the following:
RewriteEngine On
RewriteOptions inherit
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
This will allow you to utilize the second url you have posted as it will determine if the requested resource is located within the webroot and if not then redirect to the index.php file without it needing to be included in the url.
If you are not running a different web server then the rewrite rule will be different but the principle is the same. Send all requests to index.php if not resource does not live in web root.
open path:/application/config/config.php
find : $config['index_page']='index.php'
replace : $config['index_page']=''
Related
I've uploaded the project on a shared hosting and it is showing the complete directory structure of the project.
I've searched for the solutions and changed my .htaccess file. This is my .htaccess file now:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
but it is still showing the same directory structure. Any help would be highly appreciated.
Laravel is not designed to be run on shared hosting. You'll have to manually change its structure to run it on shared hosting.
Follow this article: https://medium.com/laravel-news/the-simple-guide-to-deploy-laravel-5-application-on-shared-hosting-1a8d0aee923e
Though I will recommend to buy a private server for laravel.
We have an added domain on a shared hosting. This domain is not the main hosting domain, but an added one that points to directory that matches the domain. The app was installed with a one click installer inside a dir like
ourdomain.com and Laravel public directory is accessed like
ourdomain.com/public
I need to use .htaccess to make /public the root of ourdomain.com and at the same time /public, so the project files and folders are protected as well. Can someone help show me how to do this with .htaccess?
If you do not have the access to change the settings in anything like CPANEL or similar then you can do it like this via .htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^ourdomain.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.ourdomain.com$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]
We have recently moved a Magento multi site environment to a new dedicated server, however all the sites apart from the admin URL site (not used apart from admin are) are reporting Magento style 404 pages on the front end.
We have ensured mod_rewrite is turned on, checked the database and manually amended the URLs in PHPMyAdmin to assign some temporary test URLs. The URL assigned to the admin area works fine, and the rest resolve to the server, however every front end is still 404. We have tried adding in index.php to the URL, no change. Checked all file and folder permissions, all OK. Cleared all cache manually and reindexed from command line. No change.
We have checked HTACCESS is correct which it looks to be. We have even taken another backup of the database and full site and restored to another server with the same issues.
We have also tried disabling SEO urls/URL Rewrites without change too.
Error logs dont say a lot either which isnt helpful.
Really struggling with this now so any help or pointers greatly appreciated. Thanks
First Solution:
Replace current .htaccess file with the default .htaccess file from Magento.
Second Solution:
#fastcgi_param MAGE_RUN_CODE default;
If doesn't work, try following solution:
Third Solution:
Is this installed on an Apache webserver? If not, the .htaccess functions will need to be translated to your flavor of web server software.
Has DSO module for mod_rewrite been installed in Apache and been enabled to load?
Is AllowOverrides enabled for the virtual server so Options +FollowSymLinks will function? You may have to check with your hosting service provider and have it enabled.
Is Magento's .htaccess file available in the doc root folder?
Has the rewrite engine been turned on in the .htaccess file?
Has the proper RewriteBase been assigned in the .htaccess file?
General entries in Magento's .htaccess that must function so rewrites will function to eliminate the need for index.php to appear in the URL.
<IfModule mod_rewrite.c>
############################################
## enable rewrites
Options +FollowSymLinks
RewriteEngine on
############################################
## you can put here your magento root folder
## path relative to web root
#RewriteBase /magento/
############################################
## workaround for HTTP authorization
## in CGI environment
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
############################################
## always send 404 on missing files in these folders
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
############################################
## never rewrite for existing files, directories and links
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
############################################
## rewrite everything else to index.php
RewriteRule .* index.php [L]
</IfModule>
Third solution from Fiasco Labs
I'm starting a new Codeigniter project inside of Netbeans 7.3.1 and have the following set up for my file structure.
I have in the project properties set up as the web root is pointed to public_html inside of the text box. I also have this for my htaccess file as well as I have removed index.php from the ci config file.
My problem is that when I go to localhost/MyProject it still shows the foot folder and I don't know why.
Is there anyone that sees a mistake I have made somewhere.
-root
-application
-system
-public_html
-assets
.htaccess
index.php
Options -Indexes
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
#When your application folder isn't in the system folder
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
Out of the box Netbeans doesn't come with CodeIgniter support, but that can easily be solved by installing the appropriate plugin:
https://kenai.com/projects/nbphpci/pages/Home
Due to the specific structure of a CodeIgniter project telling Netbeans that a CodeIgniter project is just another php project won't work correctly.
The detailed procedure to install this plugin can be found on their Wiki or here. Usage is explained here.
I think that you will have to restart a new project and properly activate CodeIgniter support in the project setup wizard, and that should be it.
I have installed MAMP on my laptop and moved my web project (developed using CodeIgniter) under MAMP's webroot.
I use an .htaccess file to hide my index.php file within my urls and everything is working fine...almost, everything.
I'm able to surf my site locally as in my remote server but some folders/files are not recognized. Looks like they are missing or the path is not matching the physical location on my laptop.
Basically I have configuration like below:
MAMP
htdocs
myFolderSite
.htaccess
site
myApplicationFolder
.htaccess
config
controllers
views
.....
...
myPublicFolder
css
images
.....
...
Surfing my site locally css and images are not visible. All the required files are present under the proper folders within myPublicFolder.
The .htaccess file I'm using in myFolderSite appears as below
RewriteEngine On
RewriteBase /myFolderSite/
RewriteCond $1 !^(index\.php|images|upload|users|thumb|fckeditor|public|css|js|robots\.txt|sitemap2\.xml)
RewriteRule . index.php [L]
Am I missing something?
Thanks in advance
The CodeIgniter wiki has a good article on Mod Rewrite that is worth looking at. Specifically, these two lines will stop actual files and directories being redirected.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
I've used this across a few different servers and Macs, without too many problems, so hopefully it helps.