Questions tagged [.htaccess]
.htaccess files (or "distributed configuration files") provide a way to make configuration changes on a per-directory basis.
79
questions
5
votes
1
answer
536
views
Password protect directory listing only and not the files themselves
I have in my /home/sammy/public_html/cache/.htaccess
Options +Indexes
<Files *>
AuthType Basic
AuthName "Authentication Required"
AuthUserFile /home/sammy/public_html/cache/.htpasswd
...
0
votes
0
answers
109
views
How to remove phpmyadmin login prompt
When I go to mywebsite.com/phpmyadmin/ I get a prompt to access that page, then another to login into phpmyadmin.
Suddenly I can't access the page (like if the password is wrong), I tried to Alter ...
0
votes
0
answers
428
views
Header set Access-Control-Allow-Origin code added but nothing is happening
I am trying to solve the below option on my website
Strict-Transport-Security
Content-Security-Policy
X-Frame-Options
X-Content-Type-Options
Referrer-Policy
Permissions-Policy
I found the below ...
1
vote
2
answers
105
views
How to do this (nginx) in apache2 .htaccess?
location /.well-known/webfinger {
add_header Access-Control-Allow-Origin '*';
return 301 https://mastodon.bitsnbytes.chat/$request_uri;
}
Is it possible to convert this Nginx into Apache2 ....
1
vote
1
answer
1k
views
Enable .htaccess On Ubuntu 20.04 LTS and Apache-2.4.41
I have a problem when moving my website to VULTR VPS - Ubuntu 20.04LTS with Apache - 2.4.41
I'm using Opencart for my website and my problem is whenever I move .htaccess file to the new hosting, the ...
1
vote
1
answer
336
views
How to complete my URL header in .htaccess
I have a website www.example.com running on Apache.
Maybe someone got to me via example.com, or www.example.com, or http://example.com, or even http://www.example.com.
Can I use the rewrite rules in ....
0
votes
0
answers
331
views
Can I provide meta tags within .htaccess on a 301 redirect?
I have a specific directory on my server:
www.example.com/myfavrockgroup
Within .htaccess of my server I am doing a 301 redirect:
Redirect 301 /myfavrockgroup https://en.wikipedia.org/wiki/The_Go-Go%...
1
vote
0
answers
1k
views
My .htaccess is still not read despite AllowOverride All (Apache2 / Ubuntu 18.04)
I've installed Lamp server on my system, it's set up to work on an other directory than var/www/html, my localhost it's link to a folder named Sites (home/quentin/Sites). After the installation all ...
0
votes
1
answer
871
views
Somebody trying to access my index.php file on ubuntu apache2 server (Laravel)
One of my project someone trying to access my index.php file in laravel.
Logs:-
{
"ip":"45.155.205.108","url":"/index.php?s=/Index/\\think\\app/invokefunction&...
3
votes
1
answer
224
views
How to make the file accessible only through its own server?
I've added this in the .htaccess the file located in the root of the project:
<Files *.php>
Require host lamtakam.test lamtakam.com
Require ip ::1 95.216.xx.xx
</Files>
I've used ...
0
votes
1
answer
2k
views
.htaccess not taking effect in php project
I am running Ubuntu 20.04 and am currently creating an api using php. I added an .htaccess file which SHOULD redirect any 404 pages back to my index.php. I am asking this in askubuntu because I ...
5
votes
1
answer
9k
views
.htaccess not working (apache2 | ubuntu 18.04)
guys the website is working fine, just the file .htaccess that doesn't work, i googled a lot, already enabled a2enmod rewrite and tried a lot of stuff but it didn't work.
obs: i'm using the website ...
1
vote
1
answer
741
views
How to add .htaccess code to apache2.conf?
I want to add my .htaccess code into /etc/apache2/apache2.conf.
I want to combine these:
.htaccess file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
...
1
vote
1
answer
50
views
How should a rewrite rule look like in htaccess
I want the visitors to sub.example.com to be redirected to
https://sub.example.com:9545
Is this possible with .htaccess? If so how should it look?
0
votes
1
answer
4k
views
Laravel .htaccess problem
Trying to configure my website on the hosting according to SEO requirements (www exclusion and https) getting cycling redirect as a result. Can't figure out what's wrong.
Hosting has Ubuntu 16.04.5 ...
0
votes
2
answers
162
views
htaccess redirect problem
So,
Say I have my shopping cart at foo.com/a
I want to redirect shoppers to foo.com/b
At foo.com my .htaccess contains
RedirectMatch 302 ^/(index\.html)?$ foo.com/b
But people still land on foo....
2
votes
1
answer
700
views
How do I write an Apache .htaccess file to force a 'friendly' URL?
I have a small PHP MVC framework which runs on a droplet that uses Ubuntu and I'm trying to make all the URLs 'friendly'. From:
index.php?u=controller/method/param
To:
controller/method/param
For ...
2
votes
1
answer
126
views
Apache web server - how to strip language extentions
This question pertains to publishing the Ubuntu Serverguide on help.ubuntu.com. For the 20.04 LTS cycle, there will (O.K. might) be significant changes to the source code workflow for the Ubuntu ...
0
votes
1
answer
296
views
How to make .htaccess to unhide the directory [closed]
I'm creating a VM for my students to hack into, however the directory containing .htaccess is hiding the directory they need to access to CTF. The only way you can find this directory is if you ...
0
votes
2
answers
1k
views
multiple redirects in .htaccess file - execute first one
I am attempting to use .htaccess to redirect a single page in expression engine to another site's page. Our .htaccess file has a ton of other rewrite rules and rewrite conditions to ensure the ...
1
vote
1
answer
1k
views
Can't access my website after server release-upgrade to 18.04 from 16.04 (droplet)
When I enter my domain i get:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at [...
1
vote
2
answers
5k
views
Apache2: Exclude all the rest api Request_URIs from Basic Auth by matching with some expressions
I have setup Basic Auth for an Opencart project for browser authentication to allow access to relevant users only. Now, I need to use REST API for a mobile app. When I call an endpoint from the API to ...
1
vote
1
answer
933
views
.htaccess Redirect results in a redirect loop
So on my site, my shopping cart is located at example.com/zc2.
I use this .htaccess file:
RewriteEngine On
Redirect /index.html https://example.com/zc2/
So that anyone that lands on example.com ...
1
vote
1
answer
178
views
Restricting Apache VirtualHosts to their own directory
I'm running Apache on Ubuntu 16.04 and 18.04, and I have configured it to accept connections from several domains. The sites are all stored in /var/www/html like so:
example.com
sub.example.com
...
1
vote
0
answers
296
views
Apache Rewrite sends to previous directory, local index.php not read
I can't solve a problem I have with (seemingly) Rewrites in Apache2.
It's a migration from server P3 (where everything works) to server P10. The config files are the same, as well as the directory ...
0
votes
0
answers
367
views
htaccess bad bot in access.log
I added this in my htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} ^SemrushBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Yandex [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^rogerbot ...
0
votes
0
answers
954
views
^$ Home page rewrite in htaccess not working, ubuntu 14.04
I am running ubuntu 14.04 with apache 2.4.x. I created virtual host mydomain.local. All my website works perfectly on local machine except home page i.e. http://mydomain.local/
I can run anything ...
0
votes
1
answer
1k
views
rest api ubuntu 17.10 apache mod_rewrite .htaccess
I just try and try and try ... I can't get a redirect to my index.php (restful api).
.htaccess:
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,...
0
votes
1
answer
2k
views
How to redirect all subpage to its main page?
I have migrated a static site to WordPress, now I need to redirect its pages, I have many URLs those will go one page, I can redirect one by one but those are many so I need a redirect rule that works ...
1
vote
1
answer
2k
views
My wordpress site shows the .htaccess content instead of output
I would like to migrate another wordpress site to Linode servers. I had no errors before and is doing great except now.
Here's what I did.
Back up my website’s Files
Exported the WordPress Ddtabase
...
0
votes
1
answer
202
views
Apache rewrite rules error
Some rules are working properly, and everything is properly set up in the conf files to allow rewrites to work correctly But some rules are failing or may be the url string doesnot reach that rule and ...
2
votes
2
answers
15k
views
How to Edit Apache2.conf | Permission Denied - Amazon AWS (EC2)
I'm trying upload the edited apache2.conf but getting File Permission Denied Error.
Status: Starting upload of O:\Users\Circle Radius\SRPL\apache2.conf
Command: cd "/etc/apache2"
Response: New ...
1
vote
0
answers
1k
views
Lamp in Ubuntu 16.04 and .htaccess file - not work
I installed on Ubuntu 16.04 LAMP from this tutorial: How To Install WordPress with LAMP on Ubuntu 16.04.
When I installed only Wordpress on this LAMP everything works correctly. But when I copied my ...
3
votes
4
answers
15k
views
.htaccess is not working on Ubuntu 16.04.2 LTS
I want to use .htaccess for rewriting of php web pages. Or in a simple way "I don't want to use .php extension" to access any web page.
.htaccess file (Ubuntu 14) which was working perfectly:
...
0
votes
1
answer
736
views
Custom url in my local site (problem with .htaccess file)
I have a Wordpress site and I want my url as: localhost/site/contact, for example. But, the system is displaying the follow:
You should update your .htaccess now.
If your .htaccess file were ...
1
vote
1
answer
56k
views
The requested URL was not found on this server
A question asked many times and yet I didn't find an answer that helped me.
I have an Apache Server running under Ubuntu 12.04.5 LTS (yes I need to update).
I have a webpage in /var/www/website/...
0
votes
2
answers
4k
views
.htaccess is not visible in /opt/lampp/htdocs
I have an .htaccess file saved in /opt/lampp/htdocs, the problem is, the file exists in the folder but I can't find it nor view it.
Anyone knows how I can view it?
1
vote
2
answers
665
views
Can I add my .htaccess config to my sites-enabled virtual host .conf file?
I understand that httpd.conf is no longer available in Apache at /etc/apache2. A fix is that I could create a httpd.conf file as detailed here and point my apache2.conf to it.
But browsing through ...
0
votes
1
answer
1k
views
htaccess - how to remove 'index' from url [closed]
RewriteEngine on
RewriteBase /
AddDefaultCharset utf-8
RewriteCond %{HTTP_HOST} ^(?!www\.)(.+) [NC]
RewriteRule ^(.*) http://www.%1/$1 [R=301,NE,L]
ErrorDocument 404 https://%{HTTP_HOST}
Options ...
0
votes
1
answer
102
views
Problem with .htaccess, getting Internal Server Error
I am getting a 500 Internal Server Error when I try to open my website.
The content of the .htaccess file:
RewriteEnergie on
RewriteRule ^(.*)$ index.php?p=$1
The content of the file 000-default.conf ...
1
vote
2
answers
4k
views
Apache2 gzip not working?
I've done almost everything on the internet to gzip my content. It does not seem to work. I've done so much that I can't possibly put everything I've tried here, so here's some of the things I've ...
1
vote
2
answers
421
views
Web Control Panel for Multiple Students W/Login
My teacher is trying to make a control panel for all of her students so they can use WordPress, code their website, etc.
She has a server in her class so that they can use that for the web server. ...
0
votes
1
answer
122
views
.htaccess is not working on ubuntu
I want to give
Forbidden
You don't have permission to access /draft/ on this server.
so added .htaccess to folder with
Options -Indexes
But it's not working on ubuntu server and displaying ...
1
vote
3
answers
1k
views
Display Directory Listing of .htaccess password protected directory
I want to be able to password protect a specific directory but keep others free for anyone to access, but I've found out that when a directory is password protected by a .htaccess and .htpasswd file ...
0
votes
1
answer
48
views
ServerName issue, either www or http, can't have both.. Why?
So everything is set up right at my dnsprovider. I have both my subdomain and my main domain directed to my ip. However I can't seem to get my subdomain to work with both with and without www.
If in ...
1
vote
1
answer
438
views
File .htaccess disappears
I installed ubuntu and want to put my Web script (php) what happens when I put the files via USB is the USB .htaccess disappears. Someone could help me?
0
votes
1
answer
73
views
Ensuring files on the fly are not compressed to zero byte
Gzip is enabled, i requested for site whose size is 2.7kb. Unfortunately the site was compressed to zero byte. How do you state code in htaccess to ensure files should not be compressed to zero byte ...
0
votes
1
answer
364
views
RewriteCond is not working
In my .htaccess file
RewriteRule .* /test/index.php [L]
This code working fine on apache2 on ubuntu server.
But when I add this line
RewriteCond %{QUERY_STRING} foo
It's not working. It working ...
2
votes
1
answer
92
views
accessing htaccess protected pages from ubuntu touch browser
I tried to access a webpage, which is password protected by htaccess (apache server ...) from my bq aquaris running Ubuntu touch 5.0.
The browser gave me no options to enter the username/password and ...
1
vote
1
answer
353
views
Setting up apache2 on ubuntu to avoid index.php in joomla
I have an ubuntu 14.04 azure virtual machine serving a couple of different sites.
www.example.com is set up to ip 1.2.3.4 (my server) and is redirected to 1.2.3.4/example. This works fine.
<...