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.
Related
From this answer on how to redirect a domain except for a subdirectory, and this answer on how to redirect a domain except for the homepage, I have ended up with the following in .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?this\.example.com$ [NC]
RewriteRule !^support !^directory-1 !^directory-2 (.+) https://www.this2.com%{REQUEST_URI} [NE,NC,R=301,L]
</IfModule>
However, this.example.com/work is not redirecting to www.this2.com/work.
Help appreciated.
Update, from anubhava's answer, this is my new .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^doig\.website\.technology$ [NC]
RewriteRule !^($|support|dynamic-keyword-module-drupal8|dynamic-keyword-plugin-joomla) https://www.webby.net.au%{REQUEST_URI} [NE,NC,R=301,L]
</IfModule>
However, https://doig.website.technology/my-work/ is not redirecting.
Update 2: this is my full .htaccess:
# Redirects
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^doig\.website\.technology$ [NC]
RewriteRule !^($|support|dynamic-keyword-module-drupal8|dynamic-keyword-plugin-joomla|wp-content|wp-includes|wp-admin) https://www.webby.net.au%{REQUEST_URI} [NE,NC,R=301,L]
</IfModule>
# BEGIN LSCACHE
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
<IfModule LiteSpeed>
RewriteEngine on
CacheLookup on
RewriteRule .* - [E=Cache-Control:no-autoflush]
RewriteRule min/\w+\.(css|js) - [E=cache-control:no-vary]
</IfModule>
## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
# END LSCACHE
# BEGIN litespeed noabort
<IfModule rewrite_module>
RewriteEngine On
RewriteRule .* - [E=noabort:1]
</IfModule>
# END litespeed noabort
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#RewriteRule ^support\/?(.*)$ "https\:\/\/doig\.website\.technology\/support\/$1" [R=301,L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} ^/?wp\-content/+debug\.log$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule .* - [F,L,NC]
</IfModule>
<IfModule !mod_rewrite.c>
<Files "debug.log">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
</IfModule>
# BEGIN Wordpress (new)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>
# END Wordpress
# BEGIN MainWP
# END MainWP
# Wordfence WAF
<IfModule LiteSpeed>
php_value auto_prepend_file '/home3/user/public_html/wordfence-waf.php'
</IfModule>
<IfModule lsapi_module>
php_value auto_prepend_file '/home3/user/public_html/wordfence-waf.php'
</IfModule>
<Files ".user.ini">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
# END Wordfence WAF
You may use this rule with corrected syntax of consitions:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^doig\.website\.technology$ [NC]
RewriteCond %{THE_REQUEST} !/(min|support|dynamic-keyword-module-drupal8|dynamic-keyword-plugin-joomla|wp-content|wp-includes|wp-admin)/ [NC]
RewriteRule . https://www.webby.net.au%{REQUEST_URI} [NE,R=301,L]
I am having trouble with removing the trailing slash when i redirect to another page.
See my code:
Redirect /contact example.com/page
When I run the code above it redirects me to example.com/page/ with a trailing slash.
I would like to know how I can remove the trailing slash from the url.
Full .htaccess:
# All explanations you could find in .htaccess.sample file
Redirect /configurator.html /box.html
Redirect /catalog/category/view/s/blog/id/9 http://www.example.nl/blog
Redirect /contact/index/ http://www.example.com/contact.html
Redirect /contact.html/post http://www.example.com/contact.html
DirectoryIndex index.php
<IfModule mod_php5.c>
php_value memory_limit 768M
php_value max_execution_time 18000
php_flag session.auto_start off
php_flag suhosin.session.cryptua off
</IfModule>
<IfModule mod_php7.c>
php_value memory_limit 768M
php_value max_execution_time 18000
php_flag session.auto_start off
php_flag suhosin.session.cryptua 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 .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
I have an e-commerce website created using magento. Whenever there is a 404 not found error, the loading of the site stops (or rather it keeps on trying to get that specific resource) and it kind of freezes. Other links or pages are not accessible for some time. I can browse the website only after around a couple of minutes (~5 minutes may be). Below is the screenshot of the firebug 'net' panel. First one while loading. And next after 5 minutes.
My htaccess is as below, if that has something to do with it.
DirectoryIndex index.php
<IfModule mod_php5.c>
php_value memory_limit 8M
php_value max_execution_time 180
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
RewriteBase /
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_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
</IfModule>
AddDefaultCharset Off
<IfModule mod_expires.c>
ExpiresDefault "access plus 1 year"
</IfModule>
Order allow,deny
Allow from all
<Files RELEASE_NOTES.txt>
order allow,deny
deny from all
</Files>
ErrorDocument 404 /404.html
#SetEnv MAGE_IS_DEVELOPER_MODE "true"
This happens only when a resource is not found in the page. I'm confused where to look for a solution. Thanks for looking into. Moderators, you may please rephrase the title if needed.
The 404 page template had some images missing. I removed those and it started loading correctly.
This is all of the .htaccess code:
DirectoryIndex index.php
<IfModule mod_php5.c>
php_value memory_limit 256M
php_value max_execution_time 18000
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_deflate.c>
</IfModule>
<IfModule mod_ssl.c>
SSLOptions StdEnvVars
</IfModule>
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
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>
AddDefaultCharset Off
<IfModule mod_expires.c>
ExpiresDefault "access plus 1 year"
</IfModule>
Order allow,deny
Allow from all
<Files RELEASE_NOTES.txt>
Order allow,deny
Deny from all
</Files>
Redirect 301 /content http://www.axelen.ro/tapet/
Redirect 301 /content/documents/xh76.pdf http://www.axelen.ro/
So for some reason it does not redirect PDFs. It redirects me to 404. If you try http://www.axelen.ro/content it will successfully redirects to http://www.axelen.ro/tapet/, but the PDF is not working, what should I do?
The redirect for your xh76.pdf is not working because the first generic redirect rule (/content) matches the request URL -> it's applied first.
From http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect:
Then any request beginning with URL-path will return a redirect request to the client at the location of the target URL.
Example:
Redirect /service http://foo2.example.com/service
If the client requests http://example.com/service/foo.txt, it will be told to access http://foo2.example.com/service/foo.txt instead. Only complete path segments are matched, so the above example would not match a request for http://example.com/servicefoo.txt.
The solution could be to swap the two rules so the more specific rule is being tested first or use a regular expression (eg. /content$) and the RedirectMatch directive as the documentation says.
I can't hide Codeigniter index.php on XAMPP 1.7.3
URL:
http://localhost/Servidor/agentesRainbow/index.php/agentes/tony
tony is an argument
My actual .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Servidor/agentesRainbow/
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#This last condition enables access to the images and css folders, and the robots.txt file
RewriteCond $1 !^(index\.php|images|css|public|)
RewriteRule ^(.*)$ /Servidor/agentesRainbow/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.
ErrorDocument 404 /application/errors/404.php
</IfModule>
My routes.php:
$route['agentes/(:any)'] = "agentes/index/$1";
$route['default_controller'] = "agentes";
$route['scaffolding_trigger'] = "";
My config.php:
$config['base_url'] = "http://localhost/Servidor/agentesRainbow/";
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";
On httpd.conf:
LoadModule rewrite_module modules/mod_rewrite.so
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<Directory /Servidor/agentesRainbow/>
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
Add this line to the REQUEST_FILENAME conditions:
RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]
Here is the updated .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Servidor/agentesRainbow/
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /Servidor/agentesRainbow/index.php/$1 [L]
#This last condition enables access to the images and css folders, and the robots.txt file
RewriteCond $1 !^(index\.php|images|css|public)
RewriteRule ^(.*)$ /Servidor/agentesRainbow/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.
ErrorDocument 404 /application/errors/404.php
</IfModule>
Hope it solves your problem!
I think the bar at the end of the rewrite condition is causing a problem. At least it broke the rewriting for me.
RewriteCond $1 !^(index\.php|images|css|public|)
Try removing the bar.
RewriteCond $1 !^(index\.php|images|css|public)
base_url should be just "http://localhost";
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|other|directories|you|want|accessible|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>