The content in my shared hosting htaccess file keeps getting replaced with this:
<FilesMatch ".(py|exe|php)$">
Order allow,deny
Deny from all
</FilesMatch>
<FilesMatch "^(about.php|radio.php|index.php|content.php|lock360.php|admin.php|wp-login.php)$">
Order allow,deny
Allow from all
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
I've tried location the script causing this but could not find it. I asked my hosting service and they claim it not caused by them.
Please do anyone have idea to what's causing this
Related
I know there are lots of similar (read: identical) questions, but I've tried everything - doesn't work.
This is my code:
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [L,NE,R=301]
RewriteRule ^admin/(.*)$ backend/web/$1 [L]
RewriteRule ^developers/(.*)$ api/web/$1 [L]
RewriteRule ^(.*)$ frontend/web/$1 [L]
</IfModule>
# Deny accessing below extensions
<Files ~ "(.json|.lock|.git)">
Order allow,deny
Deny from all
</Files>
# Deny accessing dot files
RewriteRule (^\.|/\.) - [F]
Everything I get is only a redirect loop.
I'm using Heroku.
Thanks.
I have a site whose .htaccess file prevents incoming traffic except certain IP's, but now I need that the image directory can be accessed from any IP.
Here is the .htaccess file placed in the root:
Options +FollowSymLinks -MultiViews
order deny,allow
deny from all
allow from 87.221.15.139
allow from 127.0.0.1
<IfModule mod_rewrite.c>
SetEnv HTTP_MOD_REWRITE On
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
The directory allowed to be accessed from any IP is /wp-content/uploads/
How can I accomplish it?
You need to create an .htaccess file inside of /wp-content/uploads with the following.
Allow from all
Now URL for my website is for example: http://localhost/xxx/index.php/welcome/
I want to change this to: http://localhost/xxx/welcome/
My .htaccess file:
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
My config.php file:
$config['base_url'] = 'http://localhost/xxx/';
$config['index_page'] = '';
But my new URL still doesn't work. What should I add there?
You can try the following mod_rewrite. It actually works and I saw this on one of the tutorials I watched here and here is the .htaccess.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /foldername/foldernameifapplicable/foldernameifapplicable
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
I do not recall all the changes made, but I followed the following tutorial and it did what you ask.
https://www.youtube.com/watch?v=I752ofYu7ag
htaccess looked like this
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
I've put on the host in magento in sub-folder /magento/ and when I try to open http://example.com/magento/ I got this error
Forbidden
You don't have permission to access /magento on this server.
I know is something from the .htaccess file because if I remove/rename it I can open it but I don't know what exactly can do this in .htaccess. Is someone had this problem before and can give some info how to fix it?
I'll post lines that are not commented in default .htaccess
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_ssl.c>
SSLOptions StdEnvVars
</IfModule>
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
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} !^/(media|skin|js)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
</IfModule>
Order allow,deny
Allow from all
<Files RELEASE_NOTES.txt>
order allow,deny
deny from all
</Files>
This looks like file permission issue. Check if your web server has the rights to read and execute on that magento folder.
I was using the search function, but none of the solutions seem to work for me. I have the following .htaccess file
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(api) - [L]
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?action=$1 [L,QSA]
ErrorDocument 404 /tsi/index.php
ErrorDocument 403 /tsi/index.php
<FilesMatch ".*\.(php|tpl)$">
Order Allow,Deny
Deny from all
</FilesMatch>
<Files "index.php">
Allow from all
</Files>
<FilesMatch "hashgenerator\.(php)$">
Satisfy Any
Allow from all
</FilesMatch>
<FilesMatch "xmlgenerator\.(php)$">
Satisfy Any
Allow from all
</FilesMatch>
<FilesMatch "api\.(php)$">
Satisfy Any
Allow from all
</FilesMatch>
I have a folder named "api" which I want to be ignored by .htaccess.