Working with cakePHP
My index.php is in www.domain.com/httpdocs/sub/app/webroot
Previously, on shared hosting I just replaced "domain.com/" with "domain.com/app+core directories" (without httpdocs/ or sub/)
I've moved to media temple dedicated virtual server and am hitting a 403 forbidden error:
"You don't have permission to access /sub/ on this server."
Permission is set to 755 for sub/ directory
In domain.com/sub/app -> .htaccess file:
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /sub/app/
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
In domain.com/sub/app/webroot -> .htaccess file:
Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteBase /sub/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
I've tried:
Right now httpdocs/ contains blank index.html and simple redirect:
Redirect /index.html http://domain.com/sub/
Creating another .htaccess file for /sub, but that seemed to confound things further.
I'm on media temple, followed this article: http://wiki.mediatemple.net/w/403_Forbidden_error
Thanks
Noticed you were having some issues with your (dv). We just wanted to let you know that we are here to help you with any problems that you may have. If you keep running into these errors, please open up a Support Request so we can help you out.
Related
I'm trying to create a subdomain for showing clients their websites in development, by creating a 'subdomains' folder within 'public_html', and then creating individual 'subdomain' folders within that 'subdomains' folder, and redirecting each new site to its associated folder.
My problem is I expect with my htaccess code, whereb navigating to, for example, subdomain.website.com, I get the error below:
"The requested URL /.php was not found on this server."
...
Here's the code for my htaccess at the moment, just not sure how I can alter this to allow me to use this setup for each future subdomain in the 'subdomains' folder without getting this issue.
ErrorDocument 404 /404.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
# RewriteEngine On
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Any help would be greatly appreciated as I'm in way over my head with htaccess stuff. Thank you in advance!
EDIT just confirming that the only file in the subdomain folder at the moment is an index.php file
Add this rule in top of your domain .htaccess file, %1 is your subdomain folder and $1 is your request (default document folder would be index.php).
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*)\.example\.com
RewriteRule ^(.*)$ /%1/$1 [L,NC,QSA]
</IfModule>
Check manual entry of subdomain folder:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain\.example\.com
RewriteRule ^(.*)$ /subdomain/$1 [L,NC,QSA]
</IfModule>
I have a cakephp application running on shared hosting server. Now I want to add a staging server for testing purpose. I defined a subdomain, and made changes in htaccess files, but these things don't work. Please suggest what should I change more.
I know similar questions have already asked on stackoverflow but nothing works for me.
sudomain name staging.example.com
Here root folder .htaccess code is mentioned here:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?example.com$
RewriteRule ^$ app/webroot/ [L]
RewriteCond %{HTTP_HOST} ^(www\.)?example.com$
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
and .htaccess file from app/webroot from staging:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
Is there any issue with such code or have to add more changes in another files.
Library is also installed in subdomain. Version of cake is 2.5.
This condition:
RewriteCond %{HTTP_HOST} ^(www\.)?example.com$
will not match your subdomain hence RewriteRule won't fire.
Just change your rule to this:
RewriteEngine on
RewriteRule .* app/webroot/$0 [L]
Hi i have this folder on my server and it is clients/nannyshareaustralia and im using a codeigniter framework i already set up the config.php in the base url too. And im adding also for the htaccess file
RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|images|js|assets|css)
RewriteRule ^(.*)$ /clients/nannyshareaustralia/index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /clients/nannyshareaustralia/index.php?/$1 [L]
and when i run it to the browser this is what it goes
Forbidden
You don't have permission to access /clients/nannyshareaustralia on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
can someone help me figured this out? Any help is muchly appreciated
Please try this Following code write in your .htaccess file
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
RewriteEngine On
RewriteBase /clients/nannyshareaustralia
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 ^(index\.php|robots\.txt|favicon\.ico|images|js|assets|css)
....
Added a RewriteBase rule to your .htaccess granting that mod_rewrite is enabled on your server.
note
If you access the directory like www.domain.com/clients/nannyshareaustralia you must add a RewriteBase to the .htaccess
But if a url/domain is pointed at the folder clients/nannyshareaustralia there is no need for the RewriteBase.
I have a blog set up at blog.ftj.com/ACSM, it is hosted with Bluehost and their folder structures seem to be case sensitive. Is there something in the .htaccess file that I can adjust so that all possible combinations get redirected to the specific uppercase URL.
Another issue is that it seems that I need to redirect
blog.ftj.com/acsm/
with and without the forward slash.
Here is my current .htaccess file
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ACSM/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /ACSM/index.php [L]
</IfModule>
# END WordPress
Please submit the full change if you would.
You need to place the following .htaccess in the root dir to rewrite all requests to /ACSM into /acsm
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/acsm$ [NC]
RewriteRule ^(.*)$ /ACSM [L]
RewriteCond %{REQUEST_URI} ^/acsm/(.*)$ [NC]
RewriteRule ^acsm/(.*)$ /ACSM/$1 [L]
</IfModule>
Sorry for delays, have not got an Apache at hands....
I have a website which was on a VPS with directadmin Control Panel, but I have just moved to another VPS with Cpanel. It used to work when it wan on the old VPS but in the new one I can’t make it work..!!
My script is CodeIgniter script and in this script this url:
www.mydomain.com/index.php/news
should be converted to:
www.mydomain.com/news
But after using htaccess, I can open the main page (which is index.php) greatly but when I want to go to www.mydomain.com/news (this should be defined as www.mydomain.com/index.php/news by htacces ) it shows me the main page. I have installed CodeIgniter (the framework I am using for my script) in the public_html folder (which is under home/user).
I have full admin access to my VPS, WHM/Cpanel and I can make any changes.
this is the .htaccess that was working for me in my old VPS:
Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# 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
</IfModule>
I have just found that by converting this line:
RewriteRule ^(.*)$ index.php/$1 [L]
to this one:
RewriteRule ^(.*)$ index.php/$1 [R]
means changing flag [L] to [R], it works, but it just converts www.domain.com/news to www.domain.com/index.php/news and shows in the addressbar and this not what I want.
Do you have any solution?! Should I change any configuration on Cpanel?!
Try this one:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond $1 !^(index\.php|images|css|js|favicon\.ico|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>
Hope it works on your CodeIgniter install, I had the same problem and this solved it.