0

Looks like this question has been asked before, but none of the solutions there worked for me.

I want to create a testing environment for my working Codeigniter (version 3.1.9) website. I thought I'd do it using a subdomain on my main domain.

I set the subdomain (test.mydoaim.com) through cPanel, and copied all the code files to the relevant directory.

Now, when I go to test.mydomain.com, or to test.mydomain.com/controller_name, it all works well, but when I try any inner links (such as test.mydomain.com/controller_name/anything), I get nothing on Firefox, or this error message on Chrome:

This page isn’t working

www.test.mydomain.com is currently unable to handle this request.

When I change this line on the subdomain htaccess file:

 RewriteRule ^(.*)$ index.php/$1 [L]

To this line:

 RewriteRule ^(.*)$ /test/index.php/$1 [L]

The error on the same inner pages changes to:

500 Internal Server Error An internal server error has occured.

And that error also appears on test.mydomain.com/controller_name, which was accessible before I changed the htacces file.

So, since the error messages has changed following the alteration, I'm guessing this issue is indeed htaccess related, but I just don't know what should the correct syntax be.


This is the full htacces file:

RewriteOptions inherit
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /test/index.php/$1 [L]

# for non www urls, add www and force https:
RewriteCond %{HTTP_HOST}(.*) !^www\. [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R,L]

# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
<IfModule php7_module>
   php_flag display_errors Off
   php_value max_execution_time 120
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 128M
   php_value post_max_size 8M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php70"
   php_value upload_max_filesize 32M
   php_flag zlib.output_compression Off
</IfModule>
<IfModule lsapi_module>
   php_flag display_errors Off
   php_value max_execution_time 120
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 128M
   php_value post_max_size 8M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php70"
   php_value upload_max_filesize 32M
   php_flag zlib.output_compression Off
</IfModule>
# END cPanel-generated php ini directives, do not edit
RewriteCond %{HTTP_HOST} ^domain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteRule ^(.*)$ "https\:\/\/mydomain\.com\/$1" [R=301,L]

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “alt-php70” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-alt-php70 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

This is my config/routes.php files, in case it is also related:

$route['default_controller'] = 'website';
$route['404_override'] = 'student/four_o_four';
$route['translate_uri_dashes'] = FALSE;
$route['demo'] = 'student/demo';
einav
  • 553
  • 9
  • 27

0 Answers0