Slir (Image manipulator) not working on server - php

I just upload my contents to my new website (server) and noticed that Slir stopped working. I read a few forum boards and noticed it could be a path issue.
Does anyone know exactly what needs to be edited or changed for Slir to work?
My Home Directory is /home/username/public_html
I used that path in the slir.configuration, however it still didnt work. I received a Page Not Found.
I am also using codeigniter and php for reference.
Localhost slir worked fine without any configurations needed.
On some of the blogs I read that slir may be having trouble with the .htaccess, but I'm not that familiar with that to change it.
# Prevent other scripts from interfering with SLIR
php_value auto_prepend_file none
php_value auto_append_file none
# Pretty URLs
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [S=40]
RewriteRule . index.php [L]
</IfModule>
# Prevent viewing of the error log file in its default location
<Files slir-error-log>
Order Deny,Allow
Deny from All
</Files>
MORE INFO
I just spoke to the web hosting IT department and they mentioned that only one .htaccess is accessible at a time. He had to close down the root .htaccess to use the slir .htaccess.
How can I fix this issue on my VPS server?

Issue Fixed!
FIXED
Just comment out the top 2 items and it worked! on the slir .htaccess
# Prevent other scripts from interfering with SLIR
#php_value auto_prepend_file none
#php_value auto_append_file none
# Pretty URLs
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [S=40]
RewriteRule . index.php [L]
</IfModule>
# Prevent viewing of the error log file in its default location
<Files slir-error-log>
Order Deny,Allow
Deny from All
</Files>

Related

.htaccess - DirectoryIndex appears to have no effect

I'm trying to adapt the .htaccess file in the root of my CodeIgniter installation so I don't have to include index.php in all the URLs leading to my controllers.
This is the content of my .htaccess file:
<IfModule authz_core_module>
Require all granted
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
DirectoryIndex login.php
RewriteEngine On
RewriteCond $1 !^(index\.php)
RewriteCond $(REQUEST_FILENAME) !-f
RewriteCond $(REQUEST_FILENAME) !-d
RewriteRule ^(.*)$ ./index.php/$1
As you can see, it's the default .htaccess file with some rewrite rules for mod_rewrite and a DirectoryIndex directive appended to it. Mod_rewrite is enabled (I've checked this using apachectl -M).
Now, I'm running Apache 2.4.18 on Ubuntu 16.04 LTS and I am using CodeIgniter 3.1.6. The problem is that when I type in no URL I get redirected to CodeIgniters index.php instead of my wanted login.php. I'd rather get the DirectoryIndex directive working instead of transferring the contents of login.php into index.php for obvious reasons. My mod_rewrite rules are meant to route URLs to existing files "through" index.php without having to include index.php in their URL. This way, my URLs are cleaner but I can still use CodeIgniter's facilities.
My master Apache configuration obviously allows me to use .htaccess files (since CodeIgniter needs this too) and the URL rewrite directives work just fine. Why does the DirectoryIndex not seem to do anything no matter where I place it inside the file?
Check out if you have AllowOverride instruction set to All -- it controls if .htaccess file has any power.
There are the answers on how to set it: How to Set AllowOverride all
I fixed the problem but not in an elegant way.
It appears to me that mod_rewrite just doesn't work (correctly) when you use it in a .htaccess file of a subdirectory of your DocumentRoot.
My CodeIgniter installation was in a subdirectory called "CodeIgniter" inside the DocumentRoot. I made two .htaccess files:
DocumentRoot/.htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %1 !^index.php
RewriteRule ^(.*)$ /CodeIgniter/index.php [L]
DocumentRoot/CodeIgniter/.htaccess:
<IfModule authz_core_module>
Require all granted
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
Options FollowSymLinks
DirectoryIndex login.php
This seems to be doing the trick for me
Moral of the story: do all of your URL rewriting using mod_rewrite in the .htaccess located directly in your DocumentRoot

What is wrong with this .htaccess? Worked fine before, but not now

I had this working on an old server and unfortunately had to switch over to a new one which had to be remade from the ground up, and now this .htaccess is not working, it throws Error 500 to any request in its directory.
Options -MultiViews
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+admin\.php\?page=([^\s&]+) [NC]
RewriteRule ^ /%1? [R=302,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ admin.php?page=$1 [L,QSA]
<Files .htaccess>
Order Allow,Deny
Deny from all
</Files>
<Files global.php>
Order Allow,Deny
Deny from all
</Files>
Options All -Indexes
The goal is to send requests to www.domain.tld/directory/log to www.domain.tld/directory/admin.php?page=log
and to also prevent viewing of the .htaccess file itself or the file global.php
As a side note I did try writing it directly into apache2.conf as a directory setting however this caused the apache2 service to be unable to start.
To know what is the problem exactly, you have to check apache error_log file
for cPanel Servers, you can try this command:
tail /usr/local/apache/logs/error_log
now the most popular 500 error for .htaccess is the use of Options line
many servers configs don't allow execution of Options in .htaccess for security reasons (overwrite configs, enable Perl execution... etc)
most server too have Options -MultiViews and Options All -Indexes already,
comment Options lines with # and your website should works just fine.

codeigniter site returns 404 error after server move

I am in the process of moving an existing codeigniter website from a MediaTemple shared server to a Dreamhost VPS server. I have set up a mirror of the new server to view the site without switching the DNS; you can see it here
I have attempted to switch the DNS, but the problems persisted.
As you can see, it returns a 404 error. If I remove the htaccess file, the home page will come up, but none of the html pages will work. I think that this has to do with the RewriteCond and RewriteRule statements in the htaccess file.
Here is the htaccess file:
AddHandler php-stable .php
php_flag allow_url_fopen on
# php_flag extension_dir=/home/86983/data/lib/php
# php_flag extension=zip.so
Options +FollowSymLinks
RewriteEngine on
# RewriteCond $1!^(js|css|images|license\.txt|user_guide|admin|phpMyAdmin|uploads|ornaments_sitemap2_25_09\.xml|sitemap\.xml|robots\.txt|quickscript\.php|paypal_ipn\.php|test\.php|sitedown\.php)
# RewriteRule ^(.*)$ http://www.ornaments.com/sitedown\.php [L]
RewriteCond %{HTTP_HOST} ^ornaments\.com$ [NC]
RewriteRule (.*) http://www.ornaments.com/$1 [R=301,L]
RewriteCond $1 !^(admin|backupForPhpMyAdmin|blog|change_page_name\.php|css|favicon\.ico|images|index\.php|js|license\.txt|ornaments_sitemap2_25_09\.xml|paypal_ipn\.php|phpMyAdmin|uploads|quickscript\.php|robots\.txt|sitemap\.xml|sub-domains|test\.php|testblog\.php|url_checker|user_guide|tinymy\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]
# RewriteCond %{HTTP_HOST} ^s86983\.gridserver\.com$ [NC]
# RewriteRule (.*) http://www.s86983\.gridserver.com/$1 [R=301,L]
#
# RewriteCond $1 !^(blog|index\.php|js|css|images|license\.txt|user_guide|admin|phpMyAdmin|uploads|ornaments_sitemap2_25_09\.xml|sitemap\.xml|robots\.txt|quickscript\.php|paypal_ipn\.php|test\.php|backupForPhpMyAdmin)
# RewriteRule ^(.*)$ /index.php/$1 [L]
Note: I did not build this site and am only slightly familiar with codeigniter and PHP in general. Any help would be greatly appreciated.
I suggest you copy in htaccess this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
</IfModule>
<IfModule !mod_rewrite.c>
#LoadModule rewrite_module modules/mod_rewrite.c
# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php
</IfModule>
We solved this one by replacing the htaccess file with the one from the openCart part of the site that worked. That file looks like this:
# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
# 2. In your opencart directory rename htaccess.txt to .htaccess.
# For any support issues please visit: http://www.opencart.com
Options FollowSymlinks
# Prevent Directoy listing
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini|log)">
Order deny,allow
Deny from all
</FilesMatch>
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /
RewriteRule sitemap.xml /index.php?route=feed/google_sitemap
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) /index.php?_route_=$1 [L,QSA]
### Additional Settings that may need to be enabled for some servers
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.
# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
#php_flag register_globals off
# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off
# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M
# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M
# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
#php_value max_execution_time 200
# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^www.shop.ornaments.com [NC]
RewriteRule ^(.*)$ http://shop.ornaments.com/$1 [R=301,L]
I am not clear on why it worked and what might still be broken that we can't yet see, but so far it looks good.

routing with htaccess and laravel

Hello I am using the following htaccess
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
For doing the laravel routing.
When I surf to example localdevurl/public/users I get the following error ( 404 )
Not Found
The requested URL /Users/username/Sites/sitefolder/public/index.php/user was not found on this server.
But as u see it shows the index.php in the error. When I put index.php in my url it does work indeed. I have turned on everything in my apache config.
httpd.conf
Can anyone see what I am doing wrong here?
In your .htaccess file, you are passing the request after the index.php part, instead of allowing laravel routing system to process it, this is:
RewriteRule ^(.*)$ index.php/$1 [L]
should be as the original .htaccess
RewriteRule ^ index.php [L]
I had the same problem with the index.php part, this is how I solved: There is a problem when you have userdir module enabled, which it seems to be the case based on the URL of the error message.
Possible solutions:
Create a symlink in the webserver folder to the public laravel project folder of the user web directory. e.g.: # ln -s ~/public_html/mylaravel4/site/public/ /var/www/mycoolsite
Then you can access http://localhost/mycoolsite
Replace RewriteCond and RewriteRule lines with this: FallbackResource /index.php
Make sure you have AllowOverride set to All instead of None for you particular vhost, and also set Order allow, deny rather than Order deny, allow in httpd.conf.
AllowOverride all
Order allow, deny

.htaccess works locally but not on server

I have apache & PHP on my local windows machine and my .htaccess rules work fine. I uploaded all my files to my Linux server and get different results. I have complete control of my Linux VPS. It isn't shared hosting or anything.
I created a file showme.php that all requests should go to. showme.php just outputs some $_SERVER variables just so I know it worked. But every request to the server gives me the 404 not found. The same request locally serves up showme.php like it should.
-Local example: http://localhost/somepage (I get the correct page rendered by showme.php)
-Server example: http://mydomain.com/somepage (I get a 404 message)
Here is my .htaccess file. I can't figure out why I get different results. Something with file permissions?
# AddType x-mapp-php5 .php
# AddHandler x-mapp-php5 .php
RewriteEngine on
Options +FollowSymlinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . showme.php [L]
ErrorDocument 404 /page-unavailable/
<files ~ "\.tpl$">
order deny,allow
allow from none
deny from all
</files>
If you use phpinfo() and do a search for mod_rewrite (usually under configuration) you will be able to tell if you have the ability to use RewriteRules. This is usually why you see IfModule wrapped around your rewrites:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . showme.php [L]
</IfModule>
The answer was that in my httpd.conf I needed AllowOverride All set in one certain place. It was there in certain directories but I guess not as default..

Categories