I've links to my website which are clicked by users and not directly in my control to be changed or encoded properly.
URL looks like this
http://mywebsite.com?email=%%username#company.com
I want this URL not to be forbidden and prevent the error 403
On other questions, people have said this "It is mod_security's 10_asl_rules.conf causing this error." I searched it and could not find mod_security on the PHP info page
here is how my .htaccess file looks like
<IfModule mod_rewrite.c>
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} (.+)=[%25][%25](.+)
RewriteRule (.*) $1/?%1=%2 [R=301,L,NC]
ErrorDocument 403 "We are working on it..."
</IfModule>
Related
I am trying to redirect people, that try to access a specific folder on web to receive 404
Example: if anyone wants to access www.mysite/myfolder/ I wish that person to receive 404 error
What I have tried by now:
RewriteCond %{REQUEST_URI} ^/node/$
RewriteRule .* - [F]
RedirectMatch 301 www.yoursite/node/
RewriteEngine on
RewriteRule ^//node/123 /node/999 /node/128173/(.*)$ /pages/errors/404.php$1 [R=301,L]
None of those really worked-received 500 error
Also tried to simply redirect everything to a non-existent site, like this:
Options +FollowSymLinks
RewriteEngine On
Redirect 301 /node/*.* http://www.your imaginary site/to-new-url
Yet, still received 500
Can anyone please help?
Why not deny access to /node/ folder?
<Directory /node/>
Deny from all
</Directory>
or modify your rewrites in .htaccess to:
RewriteEngine on
RewriteCond %{REQUEST_URI} ^node/ [NC]
RewriteRule (.*) /pages/errors/404.php [R=301,L]
But it's not good practice, 404 page should return HTTP 404 status not HTTP 301 as redirect.
Hi all and thank you for answering
my 500 error was apparently due to not specifying https in the redirect form
After that everything worked
Im currently trying to rewrite the urls of my new site by writing im my .htaccess. ive done redirects for 3 different scenarios and a generel.
The urls doesnt get redirect for nice url.
rewriting this url "http://domain.dk/?fag=1&id=87" to: "http://domain.dk/fag/1/id/87"
rewriting this url "http://domain.dk/?fag=1" to: "http://domain.dk/fag/1/"
rewriting this url "http://domain.dk/?id=87" to: "http://domain.dk/id/87"
my code is
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.domain\.dk$ [NC]
ErrorDocument 400 /?fejl=400
ErrorDocument 401 /?fejl=401
ErrorDocument 403 /?fejl=403
ErrorDocument 404 /?fejl=404
ErrorDocument 500 /?fejl=500
RewriteRule fag/(.*)/aflevering/(.*)/ index.php?fag=$1&id=$2
RewriteRule fag/(.*)/ index.php?fag=$1
RewriteRule aflevering/(.*)/ index.php?id=$2
You need the AllowOverride directive set to All for the container
I'm trying to only allow https connections to a subdomain of mine. My .htaccess looks like this currently:
Options -MultiViews -Indexes
ErrorDocument 403 /403.php
ErrorDocument 404 /404.php
RewriteEngine On
#Only allow https requests
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !/docs/?(.*)$ [NC]
RewriteRule ^ - [F]
#Docs file rewrite
RewriteRule ^docs/?$ /Docs.php
If I remove the Only allow https requests section and try to access a directory (e.g. http://foo.bar.com/images/), I am displayed my pretty 403 page. But if I leave that section in and go to the subdomain root (e.g. http://foo.bar.com/), I get the default error page, is this something to do with htaccess completely forbidding access to all files?
Examples:
Through a secure connection the 403 page works - https://api.subjectplanner.co.uk/assets
But through a non secure one, it is the default page - http://api.subjectplanner.co.uk/assets
RewriteEngine On should be before you use rewrite rules:
Options -MultiViews -Indexes
ErrorDocument 403 /403.php
ErrorDocument 404 /404.php
RewriteEngine On
#Only allow https requests
RewriteCond %{HTTPS} off
RewriteRule !^docs - [NC,F]
RewriteRule ^docs/?$ /Docs.php [L,NC]
htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^dev/(.*)/$ /out.php?q=$1 [L]
RewriteRule ^dev/(.*)/([a-z]+)$ /out.php?q=$1&s=$2 [B,L]
URL request:
http://example.com/dev/100%25%20Booster%20Juice%20(6%20Hours)/supply
For some reason, the above request results in a server error while these:
http://example.com/dev/100%25%20Booster%20Juice%20(6%20Hours)/
http://example.com/dev/Energy%20Juice%20(6%20Hours)/supply
http://example.com/dev/Energy%20Juice%20(6%20Hours)/
work flawlessly and do not generate an error. I have no idea why it's just that one specific URL that doesn't work.
htaccess 401 redirect problem
My problem is that my 404 redirect to my index.htm file is not working. The only way I can get it to work is by removing the addtype application line below, but I need this for an included left navigation on the site. Any help would be great thank you.
ErrorDocument 404 /
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$
RewriteRule .* products/noimage.jpg [L]
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^cases.com [NC]
RewriteRule ^(.*)$ http://www.cases.com/$1 [L,R=301]
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
# Rewrite Rule for blog.cases.com
RewriteCond %{HTTP_HOST} blog.cases.com$
RewriteCond %{REQUEST_URI} !blog/
RewriteRule ^(.*)$ blog/$1
AddType application/x-httpd-php .html .php .htm
I am not sure but some others had some conflicts using the AddType. Some variations that seemed to work for people are added below. Before trying and changing the AddType, put the complete file name in the 404 redirect.
ErrorDocument 404 /index.htm
EDIT:
I just tried your file, and I can't reproduce your issue. I looked at your hosting company's docs and you have it correct. The one thing I do see them mention is multiple extensions, and then takes you to a place showing the code (below) which you said didn't work
<FilesMatch "\.(php|htm|html)$">
SetHandler application/x-httpd-php
</FilesMatch>
They do show in the documentation the full domain listed and specifically mention "filename of the .html file" as shown below.
Custom Error Messages
Add the following to the .htaccess file:
ErrorDocument 404 http://forexample-domain.com/error.html
After "ErrorDocument", specify the error code, followed by a space, and then the path and filename of the .html file you would like to be displayed when the specified error is generated.
Source: http://support.verio.com/documents/view_article.cfm?doc_id=3624
If those don't work, then it probably is something with your hosting company. doesn't make to much since to me, and even if I tried to reproduce, couldn't. Sorry...