Questions tagged [.htaccess]

Directory-level configuration file used by Apache web servers. Use this tag if and only if .htaccess content is directly involved in the topic. We know many people are using .htaccess, but kindly ask the members of the community to not use this tag, unless you know it is on-topic in your question. Also notice what the [tag:apache] tag has to say about questions about _configuring_ Apache httpd and their potential off-topicness on Stack Overflow

Filter by
Sorted by
Tagged with
0 votes
0 answers
7 views

RewriteRule Apache .htaccess redirect to root directory

I've got a domain, rewrite rule used there. How can I redirect link: localhost/r/123 -> localhost/r.php?token=123 I've already tried that: RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{...
Anton Bobylev's user avatar
0 votes
1 answer
9 views

Block all countries except 1 country, but whitelist a URL from this block

To reduce spam, my website has the following in .htaccess: GeoIPEnable On SetEnvIf GEOIP_COUNTRY_CODE AU AllowCountry Deny from all Allow from env=AllowCountry However, Facebook now complains it can'...
Steve's user avatar
  • 2,105
0 votes
1 answer
7 views

Nginx trailing slash in html forms

I have the nginx config down below. I added the line "rewrite ^([^.]*[^/])$ $1/ permanent;" to make sure that when my website pages are visited when they have no trailing slash, they still ...
Mart's user avatar
  • 495
1 vote
1 answer
22 views

.htaccess with .htpasswd Password Mismatch In Docker Container

I am trying to take a website i build on Windows into a Docker Container. The Website works without Flaws but the Problem is when i try to Login i get this error in the Logs of the Docker Container: ...
Hansat's user avatar
  • 11
1 vote
1 answer
26 views

What could cause a 301 redirection? I can't find the source of one

I have a website hosted at Ionos, I built a website using Wordpress and Avada on a temporary domain provided by Ionos (https://my-site.live-website.com or something like that). Everything was fine on ...
Benjamin Loubet's user avatar
0 votes
0 answers
13 views

htaccess on Nginx website sub folder not work

PLease help. i have a website with url domain.com/login.php and after user login they will automaticly redirrect into domain/Users/Dashboard and the problem is .htaccess location is in the Users ...
Niko Andriono's user avatar
0 votes
1 answer
25 views

How to hide file path and html extension in url (cpanel jupiter theme)

I'm begginer in this and I can't find anything exactly about this so I write this My directory looks like this: Domain.com: non important stuff .htaccess index.html (main page) pages (folder) -- ...
tidex's user avatar
  • 1
-1 votes
0 answers
22 views

Url redirection to seo friendly url [closed]

I want to redirect my website url http://localhost/exams/?url=sbi-po-exam-2024 to SEO friendly url http://localhost/exams/sbi-po-exam-2024 and I am using the url slug into my code for fetching data. I ...
Shiva Kumar Sahoo's user avatar
0 votes
0 answers
11 views

set RewriteBase dynamically based on the url

I have two php web apps that want to access using the same domain but based on the URL and what I have done so far I moved the files to the Linux server and there is a root folder of public_HTML and ...
Khalil DaNish's user avatar
0 votes
1 answer
15 views

Prevent download of .htaccess file with React

I have a website in React and i would life to prevent the downloading of the file .htaccess when i go on www.mywebsite.com/.htaccess Can someone tell me how to do it please ?
user16916431's user avatar
0 votes
1 answer
29 views

How do I force clean urls with htaccess when mod rewrite enabled?

I'm trying that htaccess redirects all pages from .php to .html when mod rewrite is enabled. But I also want that in behind the scene, the server "serves" the .php files when recieving a ....
Simx72's user avatar
  • 3
0 votes
0 answers
25 views

HTACCESS LANGUAGE SELECTION

I'm developing a website where the language selection is the first part of the url: for example: www.mysite.com/en/whatever (English) For other languages, this part could be, for example: pt, pt-br, ...
user3952846's user avatar
0 votes
1 answer
36 views

Block request via htaccess if host contains X

I have many bots that are accessing my site, and since they use mostly amazon web services to spam with the requests, in the logs it looks like that: ec2-47-128-60-90.ap-southeast-1.compute.amazonaws....
Sylvia889p's user avatar
-1 votes
0 answers
20 views

Redirect multiple URLS to subdomain using htaccess

I am looking for a good htaccess rule to redirect multiple urls to a subdomain as below: www.example.com/topics www.example.com/logs There are multiple links on those two categories, all should ...
9944990's user avatar
  • 442
-1 votes
1 answer
36 views

Error using dynamic nonce in .htaccess Content-Security-Policy (CSP) and PHP

I know this has been asked countless times, but I cant seem to find a solution to my problem. The Problem : I am unable to use Content-Security-Policy nonce and its generating an error. The Error via ...
Shasha's user avatar
  • 435
0 votes
1 answer
15 views

Rewrite infected url by .htaccess

one of my WordPress sites was broken and thousands of URLs were added (regularly registered on Google Searc Console). Now I have removed the infection and I would like to remove all the URLs created ...
Davide Murmora's user avatar
1 vote
0 answers
36 views

issue with setting up a reverse proxy to fetch content from another page without changing the URL

we have a wordpress site https://a.dev.example.com.au/ where we have created a blank page with path: https://a.dev.example.com/overall-assessment-new/ now developer has a requirement to get the ...
pawan19's user avatar
  • 435
0 votes
0 answers
19 views

PowerShell: Loading Data Behind a .htaccess and .htpasswd

I have the problem that I can't load any data or view the content that's behind a .htpasswd. Is there a way to do this? I want to do it with PowerShell. Here's what I have as code: $username = 'test' $...
iSteffen's user avatar
0 votes
1 answer
34 views

OR statement in .htaccess file for RewriteRule

I saw this question where they asked how to use the OR in RewriteCondstatement. But, I need to know how to write the RewriteRule for both cases. Basically, we have both .html and .php files on our ...
peikado's user avatar
  • 75
-1 votes
0 answers
14 views

Having trouble with .htaccess and trail slash

need help with .htaccess code, I've a website having two versions, one is ending with "/" and the other version is not ending with "/". My website is developed on core .php and I'm ...
Thomas Gabriel's user avatar
0 votes
0 answers
15 views

How are pages like this generated in wordpress - example.com/?ite/41749raibtidm_html?

not using any specific custom code, but getting these urls created. What should i check? did not find anything in htaccess.
Vitalik Jimbei's user avatar
0 votes
0 answers
25 views

A spam domain has done a 302 to my homepage and i want to 403 it [closed]

I have tried this code but it doesnt seem to work. When i click from google i still go to my homepage SetEnvIfNoCase Referer "bad domain" bad_referer Order Allow,Deny Allow from ALL Deny ...
Conor Mc's user avatar
-1 votes
1 answer
22 views

Redirect from one domain to another with .htaccess

I run a bilingual website which is accessible via two domains (beispiel.com and example.com. Now I want to set up the following redirects: All urls beginning with beispiel.com/fr should be redirected ...
Tschaipi's user avatar
-1 votes
1 answer
25 views

.htaccess redirect user-account folder to a new url

I'm trying to redirect all pages on a university server's user directory to a new url with the same folder structure without success. The instructions in other posts (for example, htaccess Redirect a ...
emendelson's user avatar
0 votes
0 answers
48 views

why the antivirus detects this .htaccess file as a virus? [closed]

<FilesMatch ".*\.(?i:phtml|php|PHP)$"> Order Allow,Deny Allow from all </FilesMatch> This is for a WordPress site. I don't know if the theme require this file to work or why is ...
acti's user avatar
  • 1
-3 votes
0 answers
47 views

Add a trailing slash instead of displaying file extension [closed]

Greetings for the day!!! Sometimes I get wonder how when a user clicks on a link it takes them to another page but with a trailing slash instead of the file extension. As I'm new to learning PHP, I ...
PRAVEEN's user avatar
1 vote
1 answer
17 views

RewriteCond if static directory exists

I would like to rewrite all page requests to .html files to their .php files but only if the directory "cms" exists. RewriteEngine On RewriteCond /cms -d RewriteRule ^(.*)(\.html)$ /$1.php [...
hellnow's user avatar
  • 21
0 votes
1 answer
26 views

WordPress site inaccessible - "Site can't be reached" error

I am encountering a problem with my WordPress site, and I would appreciate any help in resolving it. When I try to access my site by entering the domain in the browser, or even when trying to access ...
Shibiliya Ismail's user avatar
0 votes
1 answer
54 views

Pretty URLs for bilingual site

I'm using quite a simple and straightforward session switch to make my site bilingual. I'd like to make the URLs a bit more SEO friendly and pretty like this - site.com/en/services so that is ...
Adam's user avatar
  • 45
0 votes
0 answers
16 views

Domain Root Showing unexpected content

https://example.com/ this url displaying 'index.php' word as a text on blank page while https://example.com/index this url displaying the index content normally. I developed a web application using ...
Hasnain Khan's user avatar
0 votes
1 answer
45 views

redirect 403 using .htaccess creates ERR_TOO_MANY_REDIRECTS

On my .htaccess i want to redirect all the 403 generated by deny from, to a custom php page My custom file is called 403page.php The code below just brings the classic 403 Forbidden white page and my ...
theok's user avatar
  • 129
0 votes
1 answer
33 views

Fixing Yourls Apache/htaccess config HTTP ERROR 500 [closed]

In the root directory I am running wordpress and within root directory I have a directory called 'y' where I run yourls url shortening platform. Wordpress should be access through www.example.com ...
Florin C.'s user avatar
  • 266
0 votes
0 answers
11 views

Issue Retrieving JSON Files in react: CORS Settings in .htaccess Applied, but Second File Unreachable

I want to retrieve data from two JSON files using the following code. The file 'data.json' can be retrieved without any issues. However, the second file in the same directory is not retrievable. What ...
sendous's user avatar
0 votes
0 answers
30 views

Non-Laravel directory inside Laravel Public directory not working

I have created a custom non-laravel admin directory inside laravel 9 public directory. My project at example.com working fine, but when I open that ( example.com/admin ), it is redirecting to example....
Learner's user avatar
0 votes
1 answer
19 views

Problem Password Protecting a Specific Page/File with .htpasswd and .htaccess

I have a .htpasswd file I created in my home directory, and an existing .htaccess file for all of my site pages. I am trying to password protect only one of these pages. I tried grouping a new ....
Mer's user avatar
  • 1
0 votes
0 answers
19 views

.htaccess : Redir only if a var in url. My script My script has a problem

My .htaccess should work as follows: It parses the url and checks if an alphanumeric variable whose name I don't know exists in the url. If so, it redirects to the redirect.php file, otherwise it ...
Stéphane Perrot's user avatar
0 votes
0 answers
22 views

Redirection 301 from prestashop category and product links (source) to woocommerce product and product links (target)

Do I need to permanently 301 redirect the category and product links of the prestashop source site to the category and product links of the woocommerce recipient site? SOURCE CATEGORY LINK: https://...
salieng's user avatar
0 votes
0 answers
10 views

.htaccess link ProxyPass

From the link https://assets.example.org/mydocument.pdf I need change for https://example.org/assets/mydocument.pdf the link that works in my server. I'm using in my .htaccess: ProxyPass "/...
Charlie's user avatar
0 votes
1 answer
39 views

.htaccess: Pretty URLs and subfolders

I do not use subfolders except for images but somehow Google find links to subfolders which results in an indexing error. Example: https://example.com/mobile/page - the mobile folder does not exist. I ...
Kim Ludvigsen's user avatar
0 votes
0 answers
30 views

Cannot rewrite parameter url with htacess in WordPress

I'm trying to do a simple URL rewrite with htaccess. But continue to receive a 404 error. This is the original URL with the parameter as at now, where "supplier" is a page on WordPress (with ...
Ihsan's user avatar
  • 150
0 votes
0 answers
6 views

set cache policy for static assets in htaccess not working

I have a question about cache policies. I'm attempting to configure the cache policy for static elements using .htaccess. Despite my efforts, Google PageSpeed indicates that my cache policy is ...
Alex's user avatar
  • 1,255
0 votes
0 answers
29 views

Hide index.php from url using htaccess not work as expected

I'm using this filemanager library in a folder of my local apache server. I've done a bit of configuration and renamed the php file to index.php. I want hide from the url the index.php?p= I've added ...
ICTDEV's user avatar
  • 279
0 votes
0 answers
37 views

How do I get users to access my website, but not without first going through another one?

I have a website and now that I have several services on my site I have decided to create a kind of portal where users can choose which service they want. The question is how do I ensure that users ...
Viraal Space's user avatar
0 votes
1 answer
29 views

lost_pass=1 URL of my crawled but unindexed product pages on GSC

I'm really hoping someone can help me. My website https://www.bathroomfusion.co.za is built with WordPress and I use Ecwid to manage the products for the website. I did a site search to see what ...
Brittany Tayla Marillier's user avatar
0 votes
0 answers
15 views

htacccess - Rewrite file with spaces to another file

Unfortunately, both files contain spaces. Old one: files/Menu 202018.pdf New one: files/Dworek karta 2023.pdf I've tried this: RedirectMatch 301 "files/Menu 202018.pdf" /files/Dworek%20karta%...
Moseleyi's user avatar
  • 2,691
0 votes
0 answers
10 views

htaccess rewrite to point subdomain to subfolder on same host

I am trying to create an htaccess rewrite that points (not redirects) a subdomain to a folder on the same host. I have three subdomains that need to be pointed to three folders. It's important that ...
James Mattison's user avatar
1 vote
0 answers
28 views

I want a htaccess file to redirect to my subfolder build where my react app is located in linux server

So my Ht access file looks like this <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] ...
Manish's user avatar
  • 11
0 votes
0 answers
12 views

Subdomain does not work with www but workws without it

My subdomain (let's call it soft.123.com) is working when I enter it like http://soft.123.com or https://soft.123.com in browser, but does not work if I add www in front of it. Chrome is showing "...
Gabriel M's user avatar
  • 20.9k
0 votes
0 answers
18 views

.htaccess File Testing

While I was testing my .htaccess file I found that all the URLs redirection I added using Redirect 301 code under RewriteEngine On are showing This redirect was not followed. Is this correct or is ...
Sandal Shukla's user avatar
-2 votes
2 answers
43 views

Why is my page from a directory is not displayed?

A PHP page when located in the root is properly displayed - https://reverd.com/why-use-reverd-com, but is not visible when placed in the about directory: https://reverd.com/about/why-use-reverd-com ...
user22105603's user avatar

1
2 3 4 5
1461