I am installing Yii2 on a shared hosting environment,Apache, (Godaddy),
here is what I did as per the docs:
Renamed web folder to www
copied all the folders, now the directory structure looks like this:
public_html\
assets
commands
config
controllers
model
modules
views
www\index.php
.htaccess (this is both in public_html and www)
but when I access my domain, I get the following error:
You don't have permission to access / on this server. Additionally, a
404 Not Found error was encountered while trying to use an
ErrorDocument to handle the request.
Here are the contents of my .htaccess which I have copied in both public_html and www.
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
is the htaccess creating problem? Is index.php not being run from the right folder? What else should I look for? any help is much appreciated.
Update:
The actual problem with the above error was that It was a Permissions issue.
Set the permissions from 644 to 755, and now the system is accessible.
BUT
the to access index.php I still need to navigate to it manually by typing in the url : www.example.com/www/index.php
UPDATE
As I don't have prettyurl's enabled, just to make it work, I deleted all the contents of the .htaccess, then I copied the contents of basic folder in the home folder (for future visitors it should be like home/your_user _name
CAVEAT EMPTOR
I know almost nothing about .htaccess. Also my this project is just for learning, this solution may not be useful in production settings.
Question is still open for expert advice on best practices in such scenario.
You need to move your domain pointer to www instead of htdocs, its probably somewhere under domain -> root folder. Your .htaccess looks fine.
Related
I've been looking for the solution for a long time. There are a lot of such topics and I know it. But I still can't figure it out. How can I remove web from the symfony2 project url? I tried to do this with htaccess looking like this:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ web/$1 [L]
but it doesn't work. It gives me an error:
No route found for "GET /web/"
I really can't change the root directory on this server as only thing I have is FTP permission. Anybody has any idea for this?
Edit: I also tried a trick to put all the files from web in root directory and the rest of the project higher. The problem is the highest directory I have access to is the root.
You shall need to update your virtual host config file and set the DocumentRoot to point to the web folder.
For example you may currently have it set as
DocumentRoot /var/www/myproject/
but you need to update it to
DocumentRoot /var/www/myproject/web
More information can be found within the Symfony2 cookbook here
Also this shall stop anyone trying to access the config/parameters.yml
Alright I have already contacted BlueHost Support and they couldn't figure out how to fix this issue. I've also tried to use cpanels 301 permanent redirect but that doesn't work so I decided to give it a whirl on here.
I host with BlueHost.com if you haven't caught that by now. The file structure is as follows:
public_html/
directory1/subdomaindirectory
directory2
directory3
I have my main website in my root (public_html). Then I have to create new directories and assign the url to that directory. So essentially if you typed in www.maindomain.com/directory1 it would show the website in the directory. I would like to modify the .htaccess to redirect that to it's original domain so www.maindomain.com/directory1 would go to www.directory1.com
The same for subdomains. I created subdomain.directory1.com and pointed it to public_html/directory1/subdomaindirectory and if you go to www.directory1.com/subdomain it pulls up the site.
I realize theoretically it's the same thing but it bugs me that you are able to pull up a website like that.
Is there anyway to modify the .htaccess to fix this issue?
In.htaccess you could do it like this
RewriteEngine On
RewriteBase /gorbox
RewriteCond %{HTTP_HOST} ^www.gorbox.com$ [NC]
RewriteRule ^support$ http://support.gorbox.com [L,R=301]
Put this in the .htaccess file that resides within the root folder of www.gorbox.com
I can't access any pages/login to my WordPress based website.
I get this message:
Forbidden You don't have permission to access / on this server.
after some research on StackOverflow and other WordPress support forums I tried to change the .htacess file without success, also tried to duplicate it from the root directory to /wp-admin again nothing has changed... But I'm not really sure about what I did...
I went back to how it was when it stopped working
permissions are 705 for the folder and 604 for the .htaccess file which is :
SetEnv PHP_VER 5_3
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I'm using WP 3.4 and I don't know if I use PHP 5.3 (what says the .htaccess 1st line) or 4.0.1 (on PHPMyAdmin from the website host access 'OVH')
Thank you very much for your attention.
Ismaƫl
Make WP recreate the .htaccess the file itself.
Delete .htaccess via FTP, then change your permalink structure to default, then back to your desired permalink style. This will recreate the .htaccess. if that fails, you can try to reinstall the WP core by deleting everything except wp-content and wp-config.php.
Found this when looking for a similar issue I had. Cause & fix was different but may be useful to others...
I have some content external to the WordPress implementation, in a directory called "Documents" (outside the WordPress hierarchy). I then wanted a Wordpress page to list those documents so I called the page "Documents". Accessing that page gave an error. The fix was to rename the directory as "docs" (moving it to wp-content may have worked too).
If you are using WP All-in-One Security plugin, be sure to check the .htaccess file in the root of your Wordpress installation, and look for a section on whitelisted IP addresses. If your current IP is not in the list, then you will get the 403 error.
I have the following shared hosting file structure using a codeigniter project:
myTLD.com/sites/mysite
mysite contains: application, system , index.php ... ( standard CI2 setup )
myTLD.com/public_html - contains : index.php
I have symlinked myTLD.com/public_html/index.php to myTLD.com/sites/mysite/index.php
Unfortunately I am getting:
Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php
I have set it up this way to avoid placing the actual site in the document root for security purposes . I don't want to change mysite/index.php because I want to keep the entire project in its mysite directory where it can easily be revised etc.
The application and mysite/ folder are set to 755 so I don't think this is a permission problem .
My myTLD.com/public_html/.htaccess folder directs all requests to index.php:
RewriteEngine On
RewriteRule ^(.*)$ index.php
Can someone advise me on an approach to sending requests through to the codeigniter index file without causing this error?
Thank you
You can try following way
1) Remove the symlink
2) Use this in htaccess at myTLD.com/public_html/.htaccess
RewriteEngine on
RewriteRule ^(.*)$ myTLD.com/sites/mysite/index.php?/$1 [L]
Use absolute system path if you are aware of it.
I have a website that is working properly.I dont know when I do "Domain-name.com/images" It shows me all the images in the images folder present at my site.I dont know why is this.may be this is due to the Directory permissions?But I want to ask know the actual reason behind it
Help will be appreciated.
Note:I am tagging Php and Html because these people might faced this thing while creating website.
This is because there is no index file in the folder, and Apache (assuming Apache) is set to do directory indexes.
Either create an empty index.html or add the following in either apache2.conf (or httpd.conf) or in a htaccess file:
Options -Indexes
You can restrict the folders using .htaccess.
Create .htaccess file in you website root folder and add the following code in it.
RewriteEngine on
RewriteCond $1 !^(css|js|images)
RewriteRule ^(.*)$ index.php/$1 [L]
This is a problem with the configuration of your web server which allows directory listing for your image folder. E.g. on Apache, the most common server software, you would switch it off in the httpd.conf with the directive Options -Indexes in a directory section.
To answer your question: yes. If it's a web accessible directory meaning it resides in the typical webroot folder such as public_html, www, etc and the permissions on the folder are open then anyone can see the contents.