sanfly Posted June 30, 2011 Share Posted June 30, 2011 Hello PHPfreaks! Im doing a server upload of a new cakePHP site for the first time in a long time, and am having some issues with my mod_rewrite (I believe this is the issue at least). My webhost has been next to useless on this issue, so Im hoping your freakiness will help me instead. With no files uploaded into the site, my folder structure looks like this in my FTP / myusername/ www.mydomain.com/ I uploaded everything from app/webroot into my webroot, which is the www.mydomain.com folder I also uploaded the app/ (without webroot) and cake/ folders into the same folder so I have something like: / myusername/ www.mydomain.com/ app/ cake/ css/ img/ etc..... index.php .htaccess etc.... Now, the frontpage of my site works fine, but when I navigate to any other page I get a 404 error The requested URL /index.php was not found on this server. In my .htaccess file <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L] </IfModule> After a bit of googling, I think that I need to add a RewriteBase line, but I cant figure out what to put. I think ive tried every combination I can think of but to no avail. One thing that may be of note is that we do not have this site/host/server connected to my domain name yet, as I wanted to get it all configured before I risked losing the old site, so Im actually accessing it by something like: http://www.mywebhost.com/www.mydomainname.com Any ideas? Cheers Quote Link to comment https://forums.phpfreaks.com/topic/240760-mod_rewrite-on-a-shared-server/ Share on other sites More sharing options...
gizmola Posted June 30, 2011 Share Posted June 30, 2011 Yes, well if I understand you correctly, your webroot (/) is the parent directory. When the rewriterule attempts to load /index.php, it is looking at the root directory (the document root) and it of course can not find the index.php. If this supposition is correct, then adding: RewriteEngine On RewriteBase /www.mydomainname.com/ //etc... May fix your problem right now, although you would most certainly not want or need that in your production environment. Quote Link to comment https://forums.phpfreaks.com/topic/240760-mod_rewrite-on-a-shared-server/#findComment-1236698 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.