500 error after moving site on PyroCMS (CodeIgniter) to other server - codeigniter

I just moved old site of my client to some test server.
The site is on PyroCMS.
I've changed database settings in aplication/config/database.php and changed base_url in aplication/config/config.php to my test site URL.
Unfortunatly site is giving me 500 error and I don't have any error logs to see what else is to change.
Where I have to do changes to site run?
My .htaccess looks like this:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
# NOTICE: If you get a 404 play with combinations of the following commented out lines
#AllowOverride All
#RewriteBase /wherever/pyro/is
# Keep people out of codeigniter directory and Git/Mercurial data
RedirectMatch 403 ^/(application\/cache|codeigniter|\.git|\.hg).*$
# Send request via index.php (again, not if its a real file or folder)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

I use PyroCMS for almost all my clients and the same issue is in the default .htaccess file.
Try to remove:
Options +FollowSymLinks
And try to add:
Options +symlinksifownermatch -Indexes
Options -MultiViews
Many hosting disable +FollowSymLinks for security reason.
Make sure to set 775 permission to:
system/cms/cache
system/cms/logs
addons
uploads
assets
Also make sure to set your env to PYRO_DEVELOPMENT to see all the errors in this debug phase.

Related

Laravel remove public from url on localhost

On production I have domain http://xxxx.com.
In root folder I added .htaccess:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L,QSA]
</IfModule>
And when I type in the browser: http://xxxx.com it works.
The same .htaccess file I have on my machine. I use XAMPP. And it doesn't work. When I type:
http://localhost:8082/myfolder
I get 404. When I type:
http://localhost:8082/myfolder/public
It works.
What is the difference between url in my hosting and on my local machine?
For the first answer:
this is a screen, maybe I'm doing something wrong (.htaccess is in the root folder), maybe .htaccess in the public folder is wrong:
This should work for you:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteRule !^public/ public%{REQUEST_URI} [L,NC]
</IfModule>
The problem with your rule is that you're checking this condition:
RewriteCond %{REQUEST_URI} !^/public/
Which actually checks for URI /public from web root however you have your site inside a subfolder locally. Here RewriteRule !^public/ will check if public/ is not there at the start after the current directory context, which will work the same in site root as well in a subdirectory.
Similarly for rewriting also make sure you don't use / before public/ to allow it to use a relative path.

website.com/index.php/page works but website.com/page doesn't

Here is the website I'm specifically talking about: http://anomet.com.
The home page loads fine, but navigating to another page doesn't, unless it's prefixed with index.php. For example: http://anomet.com/index.php/lighting works, but http://anomet.com/lighting doesn't. The website was created using Laravel 5.4.15. The website is hosted on Bell's server, and when I called them, they said mod_rewrites should be enabled. I have proper permissions set on my storage folder as well (755), since I've read that not having proper permissions on the Laravel folder can cause this problem. Here is my .htaccess file below:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
AddHandler phpCGI .xml .php
Action phpCGI /cgi-bin/php5.6fcgi
# for php5 and securewebexchange
<IfDefine SSL>
AddHandler phpCGI .xml .php
Action phpCGI https://secure9.securewebexchange.com/anomet.com/cgi-bin/php5.6fcgi
</IfDefine>
Is Bell wrong in saying that mod_rewrites is enabled? The tech support person didn't sound confident on the phone, and they didn't actually check the configuration files (i.e. httpd.conf or apache.conf) to see if it had anything like AllowOverride All or Require all granted inside of it.
Lastly, I have the exact same files uploaded to a Namecheap server (https://kdev.solutions/) and everything works on there, which further leads me to believe that the problem is with Bell's server configuration.

Magento automatically redirect me from subdirectory to main domain

I have problem with moving Magento to another server.
Old server address:
oldserver.com/shop
New server address:
newserver.com/shop
I made backup of database and FTP files from old server and I upload files and import database to new server. After changing local.xml file with new database details Magento backend is working fine, but I have strange problem with redirection from Frontend. When I enter newserver.com/shop I can see my shop homepage in a split second and than automatically redirect me to main domain: newserver.com.
I have tried to change addresses in Admin Panel:
Base URL: {{base_url}} -> http://newdomain.com/shop/
Base Link URL: {{unsecure_base_url}} -> http://newdomain.com/shop
and the same with rest edit fields and with 'Secure' tab edits. It doesn't work, still redirect me from shop directory to main domain.
On oldserver fields {{unsecure_base_url}} were default without newserver.com/shop and it worked properly.
I tried to flush/disable all Magento caches after installation and still not works.
I have tried to install clean Magento in newdomain.com directory and all is fine, it doesn't redirect me to main domain. Any ideas what is going on? :)
My .htaccess file is:
DirectoryIndex index.php
<IfModule mod_php5.c>
php_flag magic_quotes_gpc off
php_flag session.auto_start off
php_flag suhosin.session.cryptua off
php_flag zend.ze1_compatibility_mode Off
</IfModule>
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
<IfModule mod_deflate.c>
</IfModule>
<IfModule mod_ssl.c>
SSLOptions StdEnvVars
</IfModule>
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
#RewriteBase /magento/ (I have tried to change it to /shop/ and uncomment and still redirect me)
#RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]
## rewrite API2 calls to api.php (by now it is REST only)
RewriteRule ^api/rest api.php?type=rest [QSA,L]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]
#RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
#RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
#RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
</IfModule>
Check secure and unsecure magento path in db table core_config_data.
Clean
/var/cache/*
/var/session/*
/var/log/*
and also clean the cache of your browser.
Finally check if RewriteBase in .htaccess in root is set.
Unfortunately today i had the same problem with a new magento project. :-)
Please check each line in table core_config_date. Web secure and unsecure path can appear more than once.
If there is no .htaccess in the root of your magento installation you should add it.
You don't need to do a new clean install.
I asked company which created this theme at oldserver.com/shop to moving Magento. Now it's working at new server, but new server is a bit slow, so when I enter newdomain.com/shop I can see title of the page: 404, and than Magento redirect automaticaly to one of categories which is 'home' category. I think that my problem was because before Magento redirect to main domain when don't find homepage and now they set redirection of one of category. I hope that it can be useful for anybody in future.

htaccess *.php to *.html object not found error

I am trying to transform URLs from index.php to index.html, servicii.php to servicii.html and so on.
I wrote in my .htaccess file, which is in my site root the following code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\.php$ $1.html [R=permanent]
</IfModule>
?>
But when I follow "Prima pagina" (Home) or "Servicii" (the only 2 pages created on site) it gives me a 404 error
Also, I have the code
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /fetesti/
RewriteRule ^(.*)\.php$ $1.html [R=permanent]
</IfModule>
on my local machine, which is XAMPP based. It gives me Object not found 404, and on my Apache log:
file not found [...]/index.html;
I know the rewrite engine is working (I wrote gibberish and it gave me 505 internal server error and made other tests)
What am I doing wrong?
Try just remove [R] permanent redirect, and switch extensions in rule
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)\.html$ $1.php
</IfModule>

Changing uri_protocol to PATH_INFO breaks my CodeIgniter app?

I'm setting up Haughin's Twitter OAuth Library for CodeIgniter, and one requirement is to change the uri_protocol in config.php to PATH_INFO, which seems to be breaking my app in the way that all requests load the home controller (ex. Navigating to http://dev.myapp.com/login would normally take my to the Login controller, but it's just showing the default controller.)
Any ideas what would be causing this, or maybe an Apache2 configuration that's messed up?
Its to do with URL rewrites. Check your .htaccess files to see if you have the correct rewrite rules. Here is something that works for me when using PATH_INFO.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
The above should work for you without any modification. If you're hosting in a folder lets say like http://myserver.com/my_app/ then change /index.php to /my_app/index.php in both places.

Resources