Cakephp 3.x .htaccess issue on bluehost server. - php

I want to setup cakephp 3.x solution inside WP website.
On my bluehost server, I have directory structure in public_html is as follows:
I want to access stagetribescrm directory and that directory contains Cakephp 3.x file structure.
.
Code Inside of public_html/stagetribescrm/.htaccess file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /stagetribescrm/
# RewriteRule ^$ webroot/ [L]
# RewriteRule (.*) webroot/$1 [L]
</IfModule>
Code Inside of public_html/stagetribescrm/webroot/.htaccess file.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
And the problem with this code is that it couldn't load css and js files inside webroot folder's file.
Thanks.

Please check for rewrite module is turn on or not in bluehost server than
follow below link:
http://www.abhinavsood.com/install-cakephp-in-subdirectory-of-wordpress/

Related

Laravel on shared hosting with Subdomain

I Have A shared host and i have made a laravel project and when i upload it to the host
i made a htaccess file to redirect all requests to publc/index.php
and it works very well and laravel project work good
when i create a sub domain and but some files in subdomain's folder and try to access it
i got a 500 Internal Server Error
when i contaced the support they told me that this error because the .htaccess that i made
i need help to solve this problem
this is the structure of my public_html folder
-public_html
|-laravelproject
|- Laravel Projct Files
|-subdomain
|-index.php
|-.htaccess
.htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^laravelproject/public
RewriteRule ^(.*)$ laravelproject/public/$1 [L]
</IfModule>
Since subdomain is other installation i think you should add
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^laravelproject/public
RewriteRule ^(.*)$ laravelproject/public/$1 [L]
RewriteCond %{REQUEST_URI} !^subdomain/public
RewriteRule ^(.*)$ subdomain/public/$1 [L]
</IfModule>
But im no .htaccess expert, hope it works!...

Integrating wordpress to symfony 3 based website

I have a website that uses Symfony3 and am trying to integrate a wordpress blog under www.website.com/blog.
So what I've done so far is create a blog folder, under the Symfony web folder, which contains the wordpress files.
I've then added a rewrite rule, in the web/ directory's .htaccess file so that when we are under blog/, Symfony's url rewriting won't do anything :
# Passing through the Url rewriting for all blog/ urls
RewriteRule ^blog/(.*)$ blog/$1 [PT]
So far it's good. I can access the admin section and everything but the problem is that when I try to access www.website.com/blog or even www.website.com/blog/index.php I only get the list of files in the folder and not the actual front page.
And here is the .htaccess file from blog/ folder that was created when I launched the wordpress installation script:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /xxx/web/blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /xxx/web/blog/index.php [L]
</IfModule>
# END WordPress
Any ideas why ?
I think that if you have access to the sites-available's configuration file for your site, i.e. /etc/apache2/sites-available/mysite.conf.
And add a <Directory> for your blog with the WordPress rules:
<Directory /var/www/mysite/web/blog>
DirectoryIndex index.php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
</Directory>
Note: I have added DirectoryIndex index.php by myself because my Symfony have a DirectoryIndex app.php or DirectoryIndex disabled.
If you don't have access to your configuration file, probably you need to add the DirectoryIndex index.php to your .httaccess but then your configuration site and the .httaccess of Symfony should allow this directive, e.g., they should contain AllowOverride All or AllowOverride Indexes FileInfo.

codeigniter rewriting of URLS not working

In the past, I have got this working no problems at all, but for some reason on my new server I just can't get it to work.
I have the following .htaccess file in the root of my application
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
I have also enabled mod_rewrite and have confirmed this with php_info()
my site is located at /var/www/html/test
Is it possible that although mod_rewrite is enabled that it is not working and if so, how can I test it?
On some server implementations, you'll need to wrap it within <IfModule> tags.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
Also check your httpd.conf file to ensure it has:
Options FollowSymLinks
AllowOverride All
It'd also be worth checking to makesure the .htaccess file isn't being overridden by another .htaccess file.
A simple way to test if .htaccess is working
Simply put the following in your .htaccess file:
deny from All
What this does is deny access to your site from everyone. If you are presented with a 403 forbidden when trying to access the site - the .htaccess file is being included. If not - see above.
I use this on my codeigniter setup
RewriteEngine on
# prevent these directories from hitting CI
RewriteCond $1 !^(index\.php|images|assets|robots\.txt|crossdomain\.xml)
# route everything else to the index.php
RewriteRule ^/(.*)$ /index.php/$1 [QSA]
(my setup is done in the virtualhost of .conf and not in .htaccess, though they are usually about the same configuration)

Silex, in symbollically liked subdirectory, does not route

I have a Silex project. Works on localhost(using php.exe) but I've just transferred it to a subdirectory of an existing website. For example:
www.website.foo/silex/
On the site, because of funky existing routing, the silex app is symbolically linked in the webroot under a /silex/ folder, but is actually elsewhere in the filesystem. The index page works.
I wasn't using an .htaccess file, but I copied the one from the documentation, but it hasn't gotten me anywhere.
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /var/www/webroot/silex/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
I am at a complete loss as to why it doesn't work, let alone what to change to fix it.
Edited .htaccess
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /silex/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Question
Does the .htaccess file have to be in the root directory? Or is being in the application directory fine?
Your RewriteBase directive is wrong, its related to web root, not your filesystem structure, so just use RewriteBase /silex/

Cakephp showing errors when deployed in server

When i upload cake php in server, it gives me the following error:
URL rewriting is not properly configured on your server
Class 'PDO' not found in /home/is306t3/public_html/lib/Cake/Model/Datasource/Database/Mysql.php on line 177
I have included the htaccess file as advised by cakephp:
root htaccess as follows:
IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
app htaccess as follows:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
and finally the app/webroot htaccess as follows:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RRewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>
The directory structure of my website is
-app
--webroot
---htaccess
--- test.php
--htaccess
-lib
-htaccess
Hope someone can help. Thanks!
Sounds like an Apache configuration issue. You need to confirm that the mod_rewrite is enables on Apache. Here is an article that talks about how to enable it:
http://www.lavluda.com/2007/07/15/how-to-enable-mod_rewrite-in-apache22-debian/
If you do not have access to the Apache configuration, you will need to contact your hosting provider.
UPDATE
Oh I just noticed. Try updating your webroot/.htaccess:
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
Notice the ? in the rule? It should resolve it.
I'm not sure about the rewrite error but I had that PDO error as well. I had to add these two lines to the top of my .htaccess file.
Action application/x-hg-php53 /cgi-sys/php53
AddHandler application/x-hg-php53 .php
This is for HostGator though. The issue was they use php 5.2 as default for compatibility and you have to add these two lines to use 5.3 which has PDO. Maybe it will work there.
I know hardly anything about .htaccess rules but RewriteBase / isn't in any of my .htaccess files for Cake.

Categories