0

I have a Codeigniter site that works fine on my local XAMPP server, but now I've moved it to shared hosting I get a 403 forbidden error when I click on any link. The homepage displays fine, but any page with a slug produces the 403 error. E.g.

http://xxxxxxxxxxx/~test/

works fine

http://xxxxxxxxxxx/~test/about-us

produces the 403 error.

I saw this question, but my application folder and its subfolders and files already all have permissions of 755.

My Base Url is set to

http://xxxxxxxxxxx/~test/

My .htaccess looks like this:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt|static)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

EDIT: If it makes a difference, I should say that I modified the core router.php (I know it's better to create my own MY_router.php, but anyway) to allow hyphens in the URL:

$segments = $this->_validate_request(str_replace('-','_',$segments));

but I tried changing it back to

$segments = $this->_validate_request($segments);

and it made no difference.

EDIT 2:

Another update. It works with URLs like this:

http://xxxxxxxxxx/~test/about-us/consultancy

just not with this

http://xxxxxxxxxx/~test/about-us

although this does work:

http://xxxxxxxxxx/~test/about-us/
Community
  • 1
  • 1
GluePear
  • 7,244
  • 20
  • 67
  • 120
  • Does http://example.com/~test/index.php/about-us work? – stormdrain Sep 11 '13 at 16:11
  • No, that produces the same error. – GluePear Sep 11 '13 at 16:12
  • Where is the codeigniter installation? In html/index.php or html/~test/index.php (where html is the webserver root)? – stormdrain Sep 11 '13 at 16:13
  • This could be the root (no pun intended) of the problem. It's in public_html (the webserver root). The URL is currently http://123.456.789.0/~test/ which the hosting company say is until the actual domain name is configured. – GluePear Sep 11 '13 at 16:16
  • Does `example.com/~test/index.php` have the same problem? Or is this the homepage you were referring to? – stormdrain Sep 11 '13 at 16:24
  • No, that shows the homepage. That works fine, as does example.com/~test/. It's just when I put a slug after that that the 403 error appears. – GluePear Sep 11 '13 at 16:25
  • What happens if you add `RewriteBase /~test/` below `RewriteEngine on` in htaccess? – stormdrain Sep 11 '13 at 16:28
  • Thanks for your persistence! I've just tried that, and it doesn't change anything unfortunately. – GluePear Sep 11 '13 at 16:30
  • Hrm. The only other thing I can think is that `.htaccess` isn't allowed (but the full url's with index.php should still work). Can you access logs? Either apache or CI? – stormdrain Sep 11 '13 at 17:24
  • The CI log only contains some 404 errors for missing images, which I've since restored. The server log contains several errors like this: Symbolic link check failed: [/home/test/public_html/about-us], link owner does not match owner of link target. – GluePear Sep 11 '13 at 22:37
  • stormdrain, if you still have time to follow this, please see my latest edit above, it looks like i'm getting somewhere... – GluePear Sep 11 '13 at 23:01
  • Strange. See if this helps: http://stackoverflow.com/a/14243157/183254 – stormdrain Sep 12 '13 at 13:34

0 Answers0