I went through many resources here and elsewhere in net but couldnt seem to make it work.
I have codeigniter app in home directory. Sym link craeated in /var/www/html.
The below link works fine.
http://mydomain.net/dms/index.php/welcome
However without index.php ,I want the following link to work
http://mydomain.net/dms/welcome
Code igniter 2.1.1 directory:
dms
application
system
index.php
.htaccess
Config.php
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";
routes.php
$route['default_controller'] = "welcome";
Config file httpd.conf
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
Alias /dms/ "/var/www/html/dms/"
<Directory "/var/www/html/dms">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
sym links
ls -l /var/www/html
dms -> /home/user1/dms
.htaccess file :
RewriteEngine On
# enable symbolic links
Options +FollowSymLinks
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+) index.php [L]
I tried keeping .htaccess file in CI folder folder /home/user1/dms and later in /var/www/html
Both didnt work.
I am getting error (in http error log)
"File does not exist: /var/www/html/dms/welcome"
Please help.
I use this .htaccess and it works for me, try:
<IfModule mod_rewrite.c>
# Make sure directory listing is disabled
Options +FollowSymLinks -Indexes
# disable the Apache MultiViews directive if it is enabled on the server. It plays havoc with URL rewriting
Options -MultiViews
RewriteEngine on
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
</IfModule>
Related
Hello so i got back to laravel recently and want to put on my webserver but i get error 500 from a fresh installed laravel. though i havent done any modifying the code in the framework would be sweet if anyone has an idea whats going on in the changes to laravel from those settings i provide
error 500 and no logs in apache nor laravel
thanks in advance
htaccess file.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
conf file
ServerName domain.com
DocumentRoot /var/www/laravel/public/
<Directory /var/www/laravel/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
If you're using Linux os,you'll need to do the following
cd to_the_root_of_project - i.e. cd /var/www/html/LaravelProject
sudo chmod guo+w -R storage/
I have a CakePHP 2.x app here: /Users/cameron/Sites/ExampleApplication
And inside it has the standard structure:
/app
/webroot
etc.
However when I go to:
localhost/~cameron/ExampleApplication
I get the error: The requested URL /Users/cameron/Sites/ExampleApplication/app/webroot/ was not found on this server.
However if I setup a VirtualHost like:
<Directory "/Users/cameron/Sites">
Header set Access-Control-Allow-Origin "*"
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot "/Users/cameron/Sites/ExampleApplication"
ServerName example.com
UseCanonicalName Off
</VirtualHost>
It works fine!
Any ideas why it works for the VirtualHost but NOT when accessing it via the usual localhost?
Here is what is inside the three .htaccess files:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
If you use Mamp, you have to configure the htaccess file
and modify htaccess in folder root / app/webroot and app/config
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase / "production" or /nameFolder/ "dev"
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
I have codeigniter app in home directory. Sym link created in /var/www/html. I made changes to incldue .htaccess file in application folder to remove index.php in URL. The below link works fine.
http://mydomain.net/dms/welcome
That is, default method of controller works fine. But when I have method 'test' in welcome controller, the following link results in HTTP 404 webpage not found error.
http://mydomain.net/dms/welcome/test
Code igniter 2.1.1 directory:
dms
application
system
index.php
.htaccess
Config.php
$config['base_url'] = '';
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";
Config file httpd.conf
Alias /dms/ "/var/www/html/dms/"
<Directory "/var/www/html/dms">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Sym links
ls -l /var/www/html
dms -> /home/user1/dms
.htaccess file
Options +FollowSymLinks -Indexes
Options -MultiViews
RewriteEngine on
<IfModule mod_php5.c>
RewriteRule ^([^/]*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^([^/]*)$ index.php?/$1 [L]
</IfModule>
I also tried with the following 2 Rewrite rules in place of above rules in .htaccess file.
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteRule ^(.*)$ index.php?/$1 [L]
But contoller method cant be accessed without using index.php in URL. Having spent much time in this, I think it is something to do with Rewrite rules. Could some one guide me on this.
Please, test this configuration for .htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|.*\.css|.*\.js)
RewriteRule ^(.*)$ /angular1/index.php/$1 [L]
Replace "angular1" by your correct path.
with the idea of protecting / limit access to folders codeigniter, I created a public folder.
The main idea is that users can only access the public folder
<VirtualHost *:80>
DocumentRoot "www / codeigniter / public"
<Directory "www/codeigniter">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all Granted
</ Directory>
</ VirtualHost>
This works, but when I try to clean the url, so it does not appears the index.php generates an errror 503.
the .htaccess file I created is as follows
<IfModule mod_rewrite.c>
Options + FollowSymLinks
RewriteEngine On
RewriteCond% {REQUEST_FILENAME}!-D
RewriteCond% {REQUEST_FILENAME}!-F
RewriteRule ^ (. *) $ Index.php? / $ 1 [L]
</ IfModule>
What am I doing wrong or that I left to do?
pardon the English, GoogleTranslate
Your .htaccess has some strange spacing issues that break the site when I replicate them on one of my codeigniter sites. I would try with these changes.
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
I created the virtual in wamp server. Everything is working but i can't able to remove the index.php. I don't know how to write the .htaccess.
Here is the details
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot E:/Projects/OnGoing/bonanza/dev.bonanza.com
ServerName dev.bonanza.com
<Directory "E:/Projects/OnGoing/bonanza/dev.bonanza.com">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and my htaccess
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /
# Allow these directories and files to be displayed directly:
# - index.php (DO NOT FORGET THIS!)
# - robots.txt
# - favicon.ico
# - Any file inside of the media/ directory
RewriteRule ^(index\.php|robots\.txt|favicon\.ico|media|uploads|js|css|images|plugins|source|files|fonts|lib|plugins) - [PT,L]
# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php?/$0 [PT,L,QSA]
Did you setup your host file correctly to read the path of your site? For me I used this all the time works fine in development server.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]