Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/240760-mod_rewrite-on-a-shared-server/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.