My cakephp 2x site working fine on my local machine.
But i have upload on sub domain server it is not working.
I want my cakephp site working on sub domain with admin Prefix
http://vertaxtechnology.com/ => is my domain
http://dev.vertaxtechnology.com/ = is my sub domain
http://dev.vertaxtechnology.com/eventapp = is my cake directory
This is my Root htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /eventapp/
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
This is my app htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /eventapp/
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
This is my webroot htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
Please help thanks
Related
I would like to redirect the Facebook crawlers to a static page, since my website is in AngularJS and I need to work with the og:meta. I'm using Wordpress as back-end, so at the moement this is my .htaccess:
# 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 tryed to add these two lines:
RewriteCond %{HTTP_USER_AGENT} (facebookexternalhit/[0-9]|Twitterbot|Pinterest|Google.*snippet)
RewriteRule tracks/(\d*)$ http://<path>/static.php [P]
But this is not working. If I try to scrape a page with the facebook tool (https://developers.facebook.com/tools/debug/) I'm not redirect to the static page.
Keep in mind that in wordpress my permalinks are build in this way: http://<fqdn>/%category%/%postname%/ and tracks/ is one of my category.
The solution was to exclude the facebook crawler from the default 302 of wordpress.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_USER_AGENT} !facebookexternalhit/1.1
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} facebookexternalhit/1.1
RewriteRule (.*) http://<dn>/static.php [L]
</IfModule>
I have tried commenting this line present in congif/core.php,
// Configure::write('App.baseUrl', env('SCRIPT_NAME'));
But when I hit my url it gives me 404 error.
Make sure you are loading mod_rewrite correctly. You should see something like
#uncomment it by removing leading #
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
Verify that your .htaccess files are actually in the right directories. Some operating systems treat files that start with ‘.’ as hidden and therefore won’t copy them.
#CAKEPHP root .htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
#Cakephp App directory .htacess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
#Cakephp webroot directory .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
URL_REWRITING
You may fix it with your web-sersver (.htaccess rules for apache, rules in configuration file for nginx).
Im trying the find a rule that says: "if index.html part of url then do nothing"
Routes
localhost/rest/token <== Symfony REST backend
localhost/index.html/dashboard <== AngularjS frontend
.htaccess
DirectoryIndex app.php
<IfModule mod_php5.c>
php_value memory_limit 1024M
php_value max_execution_time 600
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^admin
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteRule .? %{ENV:BASE}/app.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /app.php/
</IfModule>
</IfModule>
At the top of your htaccess, put the following
RewriteEngine on
RewriteRule index\.html - [L]
This will exclude the index.html from your all rewriteRules.
My front end is in angular. I am using HTML5 mode routing in angular. I have configured my htaccess file for redirecting any URL to index.php, But it seems that it is not working.
Below is my htaccess code :
Options +FollowSymLinks
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule (.*) index.php/#/$1 [L]
</ifModule>
Please help.
Change this line :
RewriteRule (.*) index.php/#/$1 [L]
By this :
RewriteRule ^(.*)$ /index.php?/#/$1 [L]
I'm trying to setup my cakephp work on server
Purchased godaddy shared server
when i go to my site http://xyz.com/cake/
I'm getting 404 error
The requested URL /xyz/cake/app/webroot/ was not found on this server.
anyhelp plz ??
Thanks,
Satish
You need to set the correct RewriteBase in your .htaccess if you're going to run Cake inside a subdirectory.
Both /xyz/cake/.htaccess and /xyz/cake/webroot/.htaccess (assuming /xyz/cake is the path to Cake and your app dir) need to be updated.
/xyz/cake/.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /xyz/cake/
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
/xyz/cake/webroot/.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /xyz/cake/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>