I useing Magmi to import/export products, but when I visit my Magmi subfolder (www.mysite.com/magmi/web/magmi.php) is allways redirect me to my homepage. If I rename - delete - move - turn off the magento main folder .htaccess file I can access to my Magmi subfolder. Can somebody help me please how I can visit the Magmi subfolder without turning of the main .htaccess file?
Inside your Magento's .htaccess just after RewriteBase line add this rule:
RewriteRule ^magmi/ - [L,NC]
This will skip Magento's rewrite handling for /magmi/ URIs.
Add this to your .htaccess file in the magmi folder:
ErrorDocument 401 "Unauthorized Access"
This way, the browser will ask for a user/password, instead of 404'ing.
(See https://serverfault.com/questions/55323/disable-mod-rewrite-for-subdirectory)
in my case, the magmi folder had the wrong permissions. Try setting 755 permission on magmi folder and subfolders
Related
I have a site https://sitename.com/web (example). So, full path to page is sitename.com/web/index.php. On ftp server there is folder /web which also contain second page file - index-2.php. How to avoid creating /web-2/ folder and redirect index-2.php to sitename.com/web-2 ?
Easy, create an .htaccess file inside the root folder of your site, then add the following lines to it:
RewriteEngine On
RewriteRule ^web-2$ index-2.php [QSA,L,NC]
This site might help you with htaccess:
https://www.htaccessredirect.net/
A nice tutorial on .htaccess files also below:
https://www.digitalocean.com/community/tutorials/how-to-use-the-htaccess-file
How redirect everything inside rootfolder to 404, except files in root/public folder? Directory listing must be disabled everywhere and .htaccessredirected to 404 as well. It's possible to make that with one .htaccess file?
Currently i have Redirect 404 / in root, but when trying to access .htaccess, it's forbidden. Thanks
To redirect everything inside rootfolder to 404, except files in root/public folder ,you can use the following Rule in your /root/.htaccess .
RewriteEngine on
RewriteRule !public - [R=404,L]
and to disable directory listing for all folder/subfolders, add this line to your /root/.htaccess
Options -Indexes
I am working on a new website and I want the following url /newsite/products to redirect to /newsite/products/product.php.
My .htaccess file is as follows:
RewriteEngine On
RewriteRule ^newsite/products$ /newsite/products/product.php
My problem is that there is already a folder called products within newsite and when requesting newsite/products it tries to open that folder rather than go to the php file.
I get:
Forbidden
You don't have permission to access /newsite/products/ on this server.
Is there any way to make this work?
EDIT: Requested url is: http://example.com/newsite/products and location of .htaccess is in root.
You need to turn off the directory slash to rewrite your file :
Try :
DirectorySlash off
RewriteEngine On
RewriteRule ^newsite/products$ /newsite/products/product.php [NC,L]
Don't add a trailing slash in rule pattern
/newsite/products
will rewrite to
/newsite/products/product.php
and
/newsite/products/
will open your "products" directory
Note- this is not a safe solution, if you remove the rule and DirectorySlash is off, Your index file will be ignored ,all directories will start listing files and folders.
Is it possible to force a 404 error if someone tries to access any directory in my root directory (/var/www) provided the directory name contains .git?
I.e if someone tried to access http://mysite.com/site.git, it would show a 404 page?
Furthermore, how could I prevent directory listing in the same file?
I am using Apache/2.2.22 (Ubuntu).
Thanks,
Max.
Using mod_rewrite, you can put these rules in the htaccess file in your document root:
RewriteEngine On
RewriteRule \.git$ - [R=404,L]
Or, you can replace the brackets with a [F,L] to return a 403 Forbidden instead.
I have a site in /public_html folder and I have another one in /public_html/addondomain.com.
I want to disable acesss to www.domain.com/addondomain.com but users should still be able to access www.addondomain.com (contained inside public_html/addondomain.com/ folder). I have an .htaccess in public_html folder. How do I do this?
Thanks in advance.
Try:
RewriteRule ^addondomain.com /this.file.does.not.exist