So basically i created a .htaccess file which removes .html extension and redirects /file.html to /file but when i write /file.html/ it causes a 500 internal server error, How can I map/file.html/ to my custom error page ? or simply redirect that also to /file.html Here is the code : Answer With your shown samples, could you please try following(comments
Tag: .htaccess
Get PHP $_SESSION data in .htaccess for LiteSpeed cache
I need to send data from $_SESSION from PHP file to .htaccess for setup Vary variable for setting LiteSpeed cache. PHP script example: .htaccess example I already tried these ways: Via cookies. I set PHP variable in the cookies and get it from there in .htaccess via “RewriteCond %{HTTP_COOKIE} (.*) [NC]”. But I will have also private data which I
How to list a directory content
How to access directory files when we don’t have index file. I used this htaccess code but it worked when I mention file but I want to show directory file without insert index file. Please check my htaccess code and tell me where i am wrong thanks Answer You can use the Options configuration option. The documentations presents Options by
How to force HTTP to HTTPS with an exception?
So I had to force all connections via HTTP to go to HTTPS on a specific folder (e.g. “public_html/folder1”). I found a tutorial somewhere and used the following in an .htaccess file: Problem is, I have a folder inside that folder1 which should be allowed to be accessed via HTTP and not just HTTPS, how do I make an exception?
PHP: creates file but can’t append with (apparently) correct server permissions (LAMP)
I have seen many questions and answers on this topic but none seem to help my situation. My PHP code is successfully creating a new logfile, but then cannot access that file to append further info, close it, etc. I am migrating an application from local XAMPP onto LAMP: hence problem only showing up now due to Windows/XAMPP giving no
Remove .htpasswd Password Protection .(Nginx)
I added an htpasswd.txt to sites-avaiable/default to protect my site: Now that i’m trying to remove it, I can’t get rid of a .htpasswd protection I set up previously. I’ve tried everything from creating .htaccess in the root of my site with satisfy any like this post suggests and this, to deleting the reference to htpasswd.txt from my sites-available/default file,
.htaccess RewriteRule keeping URL structure
My current rewrite rule: The result above works great so I can format the URL like domain.com/a/b/c I would like to add in a domain switch as well so the results I want is sub.domain.com/a/b/c when you access it using domain.com/a/b/c Currently here is what I have tried But the result of this is http://sub.domain.com/a=a&v=b&id=c and needs to be http://sub.domain.com/a/b/c
How much does using htaccess files slow down website performance (especially with solid state disks)?
The Apache docs say (http://httpd.apache.org/docs/2.4/howto/htaccess.html), “You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance.” But that
how to generic .htaccess to prevent hotlink
The following code works fine: but I want to make a generic script serve me for several sites I manage, but fails try to get Answer You can’t use variables inside the regex. You can work around this by using a RegEx backreference like so: (note the # is just used as a boundry. It could be any character that