.htaccess in cakephp - .htaccess

I do not want to use mod_rewrite on cakephp and I want to use cakePHP's pretty URLs. So I have removed all the .htaccess files
/.htaccess
/app/.htaccess
/app/webroot/.htaccess
and uncommentted this line on core.php
Configure::write('App.baseUrl', env('SCRIPT_NAME'));
Noe the problem is...if I am putting controller and action in URL it is showing a 404 not found error.
http://www.mydomain.com/controller/action - showing not found
Can anyone help me out this.

Try either:
http://www.mydomain.com/index.php/controller/action
http://www.mydomain.com/index.php?controller/action

Related

Put Kohana web page in server with other apps

I'm trying to install a Kohana web page in a server that has another applications and I'm getting the error 'No direct access allowed'.
When I try to go to index page I see the directory. I think that it has something to do with .htaccess file or SYSPATH, but i can't figure it out.
Someone can help me?
Thank you very much
Difficult to guess what the cause of your problem might be, but do you have a line that begins RewriteBase in your .htaccess?
If not try adding one before the RewriteRule .* index.php/$0 [PT] line, in the format:
RewriteBase /directory-name-here/
So if the directory your kohana application's in is named kohana, you want a line like:
RewriteBase /kohana/
SYSPATH is defined in index.php of Kohana framework.
so make sure your .htaccess is poining to correct index file.

htaccess URL rewrite issue - permalinks

I am having some issues trying to prettify some URL's. Basically I need to make this URL http://domain.com/actualfolder/fakepath/this-is-the-article.php to display content from this page http://domain.com/actualfolder/articlemanager.php.
The articlemanager.php is setup to receive a GET url variable in the way of the "this-is-the-article" and search for it in the database. If found, it will display content specific to that result. This part works.
The part that i can't make it to work is the htaccess rule.
This is my rule but it returns 404 not found or 500 if i don't use the initial slashes.
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^fakepath/([^/.]+).php$ articlemanager.php?permalink=$1 [L]
I could really use some help, so any suggestion is welcome.
EDIT: the htaccess file lies in the domain.com/actualfolder/ location

404 custom error template .htaccess

Ok, I have a problem, my .htaccess code is:
RewriteEngine on
ErrorDocument 404 /notfound.html
and I have not found.html near .htaccess.
Why is it not working? I don't believe what I'm seeing. I took the tutorial from here
http://www.htaccessbasics.com/404-custom-error-page/
I just want that every time I access www.site.com/ajfasoijfiajsfijaofij to show what is it in notfound.html.
when using ErrorDocument , the file you're specifying is relative to DOCUMENT ROOT not .htaccess location!
Edit:
assume you have notfound.html and you want to use it for folder dir01, you create an htaccess file inside this folder and add this:
ErrorDocument 404 /dir01/notfound.html
If you want to access your file(notfound.html) in browser it would be http://www.example.com/dir01/notfound.html. that's all I could explain!
You can use in your .htaccess file the following code:
RewriteBase /

.htaccess for cakephp

I am runing a site wishberry.in on cakephp framework. I had some dirty URLs previously and now i want them to cleanup through .htaccess
I original url was wishberry.in/createwishlist3 and i want to change that to wishberry.in/brands with a 301 redirect.
The reason for using 301 is, if someone type wishberry.in/createwishlist3, the page will take them to /brands automatically.
Can anyone help me out what to write in my .htaccess file.
I would recommend doing this with routes in CakePHP rather than the .htaccess file. See http://bakery.cakephp.org/articles/Frank/2009/11/02/cakephp-s-routing-explained for more details.
The following should do the trick:
RewriteEngine On
RewriteRule ^createwishlist3$ /brands [R=301,L,NC]
Hope this helps.

.htaccess not working in subfolder

I have a couple of sites that are currently under development and I've put them under a specific subfolder for clients/co-workers to view - "http://dev.staffanestberg.com/site-name/". I've run into some problems getting the sites working with .htaccess. I can reach the index page by typing in the url for a site folder but neither img/style/js/etc linking or page rewriting works. Looking for a solution to this, Apache's "RewriteBase" seems to be the most likely one, however I can't get it to work.
Tried
RewriteBase http://dev.staffanestberg.com/site-name/
RewriteBase /site-name
What would be the correct method?
Thanks in advance,
-Staffan
mod_rewrite’s RewriteBase directive does only apply to rewrites using RewriteRule. And that does only apply for requests that are sent to the server.
But if the requested URIs are already wrong, RewriteBase doesn’t do any help. What you could try instead is the HTML element BASE that set’s the base URI for the current document.

Resources