在移动到不同的文件夹时,php中的codeigniter网站无法正常工作
问题描述:
i am new to codeigniter, i have a website which is working fine in the domain https://booktheparty.in
i have now moved the complete website to https://molugu.com/btp . have edited the following files and changed the database information also
config.php database.php
now the problem is, only home page is displaying in https://molugu.com/btp rest url are showing internal server error. for example this url https://molugu.com/btp/hyderabad
my htacces file
# HTTPS redirect
#<IfModule mod_rewrite.c>
#RewriteEngine On
#RewriteCond %{HTTPS} off
#RewriteRule (.*) https://%{HTTP_HOST}/$1 [L]
#</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/pdf "access plus 1 year"
ExpiresByType text/x-javascript "access plus 1 year"
ExpiresByType application/x-shockwave-flash "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 1 year"
</IfModule>
## EXPIRES CACHING ##
<IfModule mod_headers.c>
<FilesMatch ".(js|css|xml|gz|html)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
<ifModule mod_headers.c>
Header set Connection keep-alive
</ifModule>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)(\.gz)?$">
Header set Expires "Thu, 15 Apr 2012 20:00:00 GMT"
Header unset ETag
FileETag None
</FilesMatch>
<ifmodule mod_expires.c>
<Filesmatch "\.(jpg|jpeg|png|html|gif|js|css|swf|ico|woff|mp3)$">
ExpiresActive on
ExpiresDefault "access plus 1 year"
</Filesmatch>
</ifmodule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
</IfModule>
i am really new to this framework, can anyone please tell whats the problem
</div>
答
I think you should modify the .htaccess
file to also include the subfolder :
RewriteEngine on
RewriteCond %{HTTP_HOST} ^molugu.com$
RewriteRule ^/?$ "http\:\/\/www\.molugu\.com\/" [R=301,L]
RewriteRule ^$ btp/ [L]
RewriteRule ^(.+)$ btp/index.php?/$1[L,QSA]