Stuck into a strange situation while upgrading the website to Codeigniter.
http://website.com/download - View .php page
http://website.com/download/files - Directory
If I allow directory within the .httaccess file, view stops working. Similarly, when I disallow directory, view works but directory URL throws error.
Please help
U can configure in virtual host setting.
Allow directory listing.
<Directory /usr/local/apache2/htdocs/listme>
Options +Indexes
</Directory>
Disable directory listing.
<Directory /usr/local/apache2/htdocs/dontlistme>
Options -Indexes
</Directory>
Related
I successfully installed Laravel and Laravel Nova in live server but when I tried to view Nova login page, I get index of/nova page and the page does not redirect any css.
Below is the screenshot of the page rendering:
In the config/nova.php the path is correctly set to:
config/nova.php
I need help to get this page to display correctly.
I found what the problem was. I got index of/nova because Laravel Nova login page was looking for the css folder, js folder, .htaccess, web.config from the root directory and it could not find then it displays index of/nova.
When I moved css folder, js folder, .htaccess, web.config to the root directory, then voila I get the login exactly as I wanted.
Below is the correct display of laravel login page:
Thanks everyone who tried their best to help.
In your case the problem might not be with the web application but with the settings of the webserver.
I use Apache and this is what my 'virtual hosts' (httpd-vhosts.conf) configuration looks like for one web application:
<VirtualHost *:80>
ServerName laraveltest1
DocumentRoot "c:/users/jorisj1/source/repos/laraveltest1/public"
<Directory "c:/users/jorisj1/source/repos/laraveltest1/public">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
In your case the DocumentRoot might point to the actual root of the application. Try changing it to the public directory.
Talking about my project I am working, its just a simple website in localhost.I am Xampp server rand inside htdocs my website is in file creative which contains index.php file and another sub directory themes which further contains themes folder which contain all the necessary html php and css files that builds my websites.
When a user enters I want to redirect him from the index.php in localhost/creative to the index.php in localhost/creative/themes/theme-folder. I tried to use require_once('creative/themes/theme-folder/index.php'); but in most of cases it fails. is there any other way to do so.
You can modify the .httpd file.
Then you add:
#The path of your repositories:
DocumentRoot "C:/xampp/htdocs/creative"
#then you make an alias:
Alias /creative "C:/xampp/htdocs/creative/themes/theme-folder"
<Directory "C:/xampp/htdocs/creative/themes/theme-folder">
#Modify this data according to your needs
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
I have just installed a laravel project into my Home/public_html folder. I gave it a name, let's call it laravel for this purpose. So the template installed to Home/public_html/laravel and then I ran a composer install. I got a database password error. I fixed that, ran it again, and all went well. I then created a migration, a controller, and a view. I tried to navigate to it via localhost/laravel/public/events (events is my created view) I get a 404. I remembered I needed a config file in etc/apache2/sites-available I created the config file with this structure:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /home/user/public_html/laravel/public/
<Directory /home/user/public_html/laravel/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/laravel-error.log
CustomLog ${APACHE_LOG_DIR}/laravel-access.log combined
</VirtualHost>
I then created a symlink into the sites-enabled folder. That didn't help.
I then navigated to localhost/laravel and it just gives me the directory structure.
What have I missed? What have I done wrong?
I have another folder inside public_html with its own config file that works perfectly (it points to home/user/public_html/. It also has a symlink. Is there something in each project that tell the project which config to use? Do they just work? My knowledge of this really stops here. Basically, I've exhausted what I know. What am I missing/doing wrong?
Oh and I have restarted apache as well. - a couple of times through the steps I just detailed.
Exposing the Laravel instalation to the web server is never a good idea. Since you can access the file listing of the laravel folder, I believe your document root is set to /home/user/public_html.
Better approach to solve this problem will be as follows.
Keep entire laravel installation outside public_html directory. Let's assume inside /home/user/development
You may need to add following to the apache configuration below DocumentRoot.
Alias /laravel /home/user/development/laravel/public
Add following Directory Configuration
<Directory /home/user/development/laravel/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Add following to .htaccess file in /home/user/development/laravel/public/ below RewriteEngine rule.
RewriteBase /laravel
Restart the apache2 server, your site should be available on localhost/laravel. Make sure there are no folder named laravel inside the public_html folder.
in my apache sites-available/default file i had change the config to folowing:
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All //originally was AllowOverride None
FallbackResource rewrite.php //i added this line, too
Order allow,deny
allow from all
</Directory>
i wanted to handle all url calls in my own rewrite.php file. this works, when i visit my site at http://192.168.1.104:4567/web/knxzkcha but doesnt work when i go for http://192.168.1.104:4567/web/. i got this problem in firefox : The connection to the server was reset while the page was loading.
the index site http://192.168.1.104:4567/web/index.php works flawlessly and shows me my index.php file. all i want is to let me show the index file when visiting the root directory, too. /var/www points to the /web directory. i have some ubuntu 12.04 server 64 LTS edition
when i rewert the config lines, the root gives me the index file by default.
You do not need to add AllowOverride All, telling apache to avoid IO by checking existence of .htaccess files in current directory and all parents directories with AllowOverride None is a good recipe for speed. Avoid .htaccess files if you can edit Apache configuration.
Now FallbackResource is a quite new feature and may have some bugs. Did you check the ErrorLog for details? Could you try that with LogLevel debug?
It seems you problems is with directories, maybe you could fix it by enforcing usage of your fallback when a Directory is requested, try to add:
DirectoryIndex rewrite.php
I am not sure why this is happening as I am not very knowledgeable when it comes to Apache. Below is a copy of my VirtualHost.
If this gives any extra help as to how to get it to work, I am trying to run a CakePHP site. I know the site itself has no issues as I have another location I manage the code from and can get it running locally through Apache there.
<virtualhost *:80>
DocumentRoot "C:/sites/sitename"
ServerName dev.sitename.com
ErrorLog "logs/sitename.com-error.log"
CustomLog "logs/sitename.com-access.log" common
<directory "C:/sites/sitename">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Allow,Deny
Allow from all
</directory>
</virtualhost>
I am running this on Apache 2.0 and Win7sp1
UPDATE
I never found the real solution using the route I was on. I downloaded a fresh copy of WAMP and was soon able to get everything up and running, no problem.
In order to prevent apache from showing the directory listing, you need to disable indexes. Also, it's best to disable MultiViews as that will enable content-negotiating, which may produce unwanted side-effects
Change the options to;
Options -Indexes FollowSymLinks
Then, check that the .htaccess file is present inside your webroot (C:/Sites/Sitename), as that file is used to enable mod_rewrite
Additional pointers/hints
First of all, make sure that the DocumentRoot is pointing to the right directory of your application;
The standard directory structure of CakePHP looks like this;
app
/Config
/Controllers
/Views
......
/webroot
lib
/Cale
plugins
The DocumentRoot should point to your `app/webroot' directory, which contains all 'public' files.
Change the paths/directories in your virtual host to that directory and restart Apache.
If you're still getting a 403 error, change the URL you're visiting in your browser to this;
http://mywebsite.com/index.php
If this does work, check if the .htaccess file is present in that directory and mod_rewrite is installed in your Apache.
According to the answer from "thaJetzah" (sorry, can't comment yet:) )
403 Forbidden is better than having the index of the folder, because now you can see the logs/sitename.com-error.log log and hopefully it tells you, why it gives 403.
Just to make sure: The index.php is in the folder "C:/sites/sitename"?
If you can't isolate the error like this, it would be great to post here the output of the error.log when you try to access the page and it gives you 403.
Check this If you are running Ubuntu.