Questions tagged [.htaccess]

Directory-level configuration file found mostly on Apache web servers

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

Apache 2.4 "client denied by server configuration" caused by Require expr - even though the request succeeds

Our apache error log is littered with messages saying "client denied by server configuration", even though the htaccess configuration is working as intended. Here is the relevant bit of the ...
  • 101
1 vote
1 answer
11 views

Apache ToLower on all Wordpress pages (not PDF/CSS/JS)

I'm having issues performing a 301 redirection of URLs that contain capitals to lowercase, excluding static files (PDF/CSS/JS/JPEG/JPG/PNG/WEBP...etc). For example: https://www.example.com/Page/ would ...
0 votes
1 answer
27 views

How to redirect all pages that contain a specific word using the .htaccess file

I have a bunch of indexed pages that start with the same word and they are all 404 so I want to redirect them all to the homepage of the site. The server is Apache, so I would like to use the ....
1 vote
1 answer
62 views

htaccess redirect all subpages to parent page except for some parent pages

I want to match all subpages to parent pages, am using wordpress, will that mess up the images and wordpress files?, And I have tags and categories, and I want to exclude them from this rule. ...
1 vote
1 answer
29 views

Redirect all URLs ending in ".-detail" to remove the dot

I have a rather odd situation where our old URLs are ending in .-detail and need changing to just -detail. For example: example.com/product.-detail needs changing to example.com/product-detail In ...
0 votes
0 answers
12 views

Redirecting all 404s to a custom page using Nginx $mod_rewrites

How to redirect all 404s and any random characters after my domain all to the main domain? I'm using $mod_rewrites = [ code because .htaccess and other things are not working. For Example : From this ...
  • 1
1 vote
1 answer
46 views

Apache htaccess ruleset: Try request as: 1) file as-is 2) file + .html suffix 3) DirectoryIndex 4) Else to index.php CMS router

I'd like to express this ruleset If the request is /hello then try the following in the given order: /hello — File of that name exists (file without file extension). Edit: Not a necessity. Only a ...
  • 141
2 votes
2 answers
646 views

.htaccess - Redirect all URLs with one exception

I want to redirect all URLs from one domain to another. Some of the old URLs have new counterparts with specific pages to redirect to. All other URLs should redirect to the homepage of the new domain. ...
  • 135
0 votes
2 answers
51 views

HTTP 403 with CloudFlare

I've added my site to CloudFlare. I'm trying to allow requests to only come in through CloudFlare's network, and reject all others. When I add the following to my .htaccess, I get HTTP 403 Forbidden. #...
2 votes
0 answers
53 views

Htaccess to Nginx with pre-configured options

I have a website that run under nginx, with directives applied by Cloudpanel and i want to add my crm on it, the crm have 2 .htaccess file, one in the root folder and one in the /public folder. I'm ...
1 vote
1 answer
43 views

htaccess: 301 redirect defined URLs to new domain and catch all redirect the rest

I want to redirect some URLs from an old domain to new versions on a new domain. The old domain uses the www. subdomain and SSL. For example: olddomain.com/audi -> newdomain.com/cars/audi ...
  • 135
1 vote
1 answer
96 views

Redirect www to non www and redirect to index.php

my www folder has the following .htaccess RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] my api folder (within the ...
  • 135
1 vote
1 answer
86 views

How do I add the __Secure prefix in this .htaccess line?

Sorry, I'm not an Apache expert. I need to add the __Secure prefix to this htaccess line: Header onsuccess edit Set-Cookie (.*) "$1; SameSite=Strict; Secure" is this possible? How?
-1 votes
1 answer
48 views

I'm in trouble with .htaccess RewriteRule

I'm trying make to a social platform like Instagram or Facebook and I wanna to show users, username like that examplesite.com/usernamehere so in the url. I'd been researching how to do this and I ...
1 vote
1 answer
39 views

How Can We Do 301 Redirect Of Over 200 Pages To Corresponding 200 Pages At New Location?

I need help and need it fast. We recently migrated a subdomain to integrate with the domain. Eg. https://blog.example.com to https://www.example.com/blog https://blog.example.com has a ton of traffic ...
1 vote
3 answers
54 views

Apache: How to "hide" a subdomain but serve over https

I will freely admit my ignorance - or perhaps enough knowledge to be dangerous. I have a subdomain http://db.<mydomain>.com that serves the phpMyAdmin utility. It's currently in a directory with ...
0 votes
0 answers
154 views

.htaccess for Wordpress in a subfolder

I have a setup where a static website sits in the root folder and Wordpress is located in a subfolder. So I need to rewrite all requests to index.html while all Wordpress-related requests should go to ...
  • 1
0 votes
0 answers
14 views

htaccess rewrite rule not applied when in A2HS/PWA mode?

My symfony5 application serves up a microsoft azure SSO link up front, and it works great through the browser. When a user opts to add my app to their iOS homescareen however, there is a problem. Here ...
2 votes
2 answers
313 views

How can I remove 2 separate portions of a URL using mod_rewrite?

I have this unfortunate URL: dom.tld/library/Photography/index.php?cmd=image&sfpg=2021/*IMG_3468.jpg dom.tld/library/Photography/index.php?sfpg=2021/* This should look like this dom.tld/library/...
1 vote
1 answer
58 views

Apache mod_rewrite RewriteRule loops despite L flag

Apache/2.4.54. I am trying to achieve that similar URLs (e.g. "/anystuff.htm") are externally redirected to "/something" which internally is "something.html". But the ...
  • 113
1 vote
0 answers
11 views

Setup Authentication for landingpage fetching data from proxy via access restriction?

Imagine the scenario where you have a client who wants you to implement calls to an external API on a landingpage that you've setup for them. The external API works based on a contract and API keys ...
  • 135
0 votes
0 answers
34 views

Server 500 error caused by mod_rewrite with Apache

So i've been trying to get this particular script installer to run, and I cannot seem to figure out why it won't process the rewrites properly. In my .htaccess file within the root directory, I have ...
  • 101
0 votes
0 answers
45 views

Nginx rewrite - not working - convert from htaccess

I have a .htaccess file and I'm trying to convert it to an NGINX URL Rewrite configuration. Unfortunately, none of the available converters help. Every time I get either a 403 error or 'No input file ...
0 votes
0 answers
36 views

How to server index.php from different directory through .htaccess?

I am working on a project which is in Yii2. I have to integrate swagger UI for API documentation. My current directory structure: This is what the .htaccess looks like: RewriteEngine on RewriteCond %{...
0 votes
0 answers
86 views

Migrating Wordpress to IIS convert .htacces to web.config

An outside company is making a website, they are working on LAMP, there is an IIS server at our place so I have to prepare this server for the implementation. Preliminarily it has been prepared (I ...
0 votes
0 answers
161 views

Want to redirect URL and change slug to url parameter

I am stuck with a mod rewriting on Apache htaccess. my URL looks like this : http://localhost/Ac5GRnXW I want it to redirect like this: http://localhost/redirect.php?id=Ac5GRnXW I am using the ...
  • 1
1 vote
1 answer
30 views

htaccess syntax issue when moving script to a subfolder

I have recently purchased a script but this script only works in public_html folder . I need to install it in a subfolder named shop ( public_html/shop/ ) . Now the following .htaccess rules work ...
  • 33
0 votes
0 answers
36 views

Rewriting URL encoded with htaccess

have a single page website that uses the hash (!#) to access different pages. he problem is that some product viewers break my links encoding the hash character, replacing !# with domain main , so for ...
1 vote
1 answer
524 views

htaccess, block access a url with parameters

If I want to block access to example.com/path/?xxxx (xxxx is variable), but allow access to example.com/path/, how should I write it in my .htaccess?
  • 11
2 votes
1 answer
837 views

Redirect part of a URL parameter to the URL-Path

I used a module that created links like this: https://example.com/login?create_account=1&back=https://example.com/product/2164/?ets_rv_add_review=1 I need to redirect them to: https://example.com/...
  • 21
1 vote
1 answer
65 views

RewriteCond rules from apache to nginx

RewriteCond %{TIME_SEC} >40 RewriteCond %{TIME_SEC} <56 RewriteRule ^(.*)the-product(.*)$ https://www.%{HTTP_HOST}/%{REQUEST_URI} [R=301,L] I want to convert it to nginx but there is no ...
1 vote
1 answer
197 views

.htaccess redirect if param value not portuguese-pt (FORCE WHMCS ONLY ONE LANG)

I need help to redirect URLs with multiple language codes to one with .htaccess. The following URLs should redirect: https://example.com/cp/cart.php?a=add&pid=7&language=us https://example....
1 vote
0 answers
13 views

Redirect docroot for specific URI path by .htacess

Is it possible to redirect a specific URI path to a specific docroot within the original docroot using the .htaccess? For example: example.com > docroot Where example.com/path > docroot/subdir
  • 117
0 votes
0 answers
74 views

Redirect complete ip-ranges with IPv6 - How to do it in htaccess?

How can I use this rule to redirect unwanted visitors with their complete IP range (with IPv6) to another domain, for example: 2001:9e8:2000::/35 to google.com. I've been experimenting for weeks and ...
  • 1
1 vote
0 answers
67 views

Automatically remove Set-Cookies

I have a php web application. This web application sets some cookies. I want to write a .htaccess which remove on the fly this cookies. Here is what I've done, with mod_header: Header unset Set-Cookie ...
  • 269
1 vote
1 answer
131 views

How to move site to a sub directory and 301 redirect it?

I have changed my site path from root directory to a subfolder. Eg: example.com to example.com/subfolder and everything is working fine. but now I want to 301 redirect old URLs to New URLs. Eg: ...
1 vote
1 answer
226 views

Condition depending on domain in .htaccess: SetEnvIf and IfDefine?

I would like to add a rule in .htaccess that "Does something" (actually enable a httpauth user restriction) depending on the domain name. I thought I had it and did: <IfModule ...
  • 115
1 vote
0 answers
36 views

How to remove number from the URL?

I have wordoress site where I am getting /1 in the URL. I have checked siteurl,homeurl,permalinks but not sure why /1 is getting added in the URL e.g https://example.com/consulting/strategic-marketing/...
0 votes
0 answers
129 views

Convert multiple Apache/.htaccess files to Nginx config

main .htaccess # BEGIN WordPress # The directives (lines) between "BEGIN WordPress" and "END WordPress" are # dynamically generated, and should only be modified via WordPress ...
  • 1
0 votes
1 answer
102 views

Block IP adresses via htaccess without possible override

I have blocked some IP addresses within the .htaccess of my webpages root like this: <RequireAll> Require all granted Require not ip xxx.xxx.xxx.xx </RequireAll> I also use some plugins ...
  • 129
0 votes
0 answers
34 views

Wordpress crashes Internal Redirect

I am trying to find the issue why my Wordpress installation makes a 10 times redirection and crashes the session. The hint that I am getting from the Apache logs is: [perdir /usr/www/users/server/...
  • 101
0 votes
0 answers
93 views

Enable webp support on Nginx+Apache reverse proxy with moss.sh

I am scratching my head from last few hours but unable to get reliable source to solve below problem. Actually, I am trying to setup WP Smush (or any webp plugin) with webp support on Nginx + apache ...
3 votes
2 answers
782 views

seo friendly url not working

I have a folder structure like the below www.exampe.com/distributor/index.php and I want to access the file via an seo friendly www.example.com/distributer/abcinc and then in the index.php want to ...
  • 135
1 vote
0 answers
56 views

when it goes to https:/... directly it is missing the referer part

it's all about cookies ,it suppose redirect to ?referer_id=186 every time which is refresh the cookies of new logo but i notices when user delete or clear the history of Brower and try to visit the ...
0 votes
0 answers
52 views

Wildcard SSL for subdomains that don't exist

If I have undefined subdomains, and there is a wildcard subdomain defined for the domain (via the hosting account at JustHost), is it possible to have a wildcard SSL certificate for subdomains that ...
0 votes
0 answers
91 views

$_POST is empty when obtaining in "ErrorDocument 404" (nginx + apache + mod_php)

I try to transfer website from old server to new, and stucked with one problem. PHP/JS code on both servers is the same, but on new server it is not working - $_POST data are empty in AJAX-request. ...
  • 1
0 votes
0 answers
23 views

apache mod_rewrite path to querystring - keep base directory

I try to "beautify" my URLs from eg. www.example.com/page.php&id=3 to www.example.com/page/3 I can achieve this with: RewriteEngine On RewriteRule ^(page)/([0-9]+)$ page.php?id=$2 The ...
  • 1
0 votes
1 answer
127 views

Error: The response is not a valid json response. WordPress Windows server

I personally rented a Windows virtual server and installed and set up mysql+phpadmin+IIS and after that I started my email server and tested it and everything was ok, then I installed WordPress and ...
  • 1
0 votes
0 answers
30 views

Can I Use .htaccess to solve this URL issue?

My web app had an issue with URL, ex; domain.com/dashboard will give a 404 error but domain.com/dashboard.php will show perfectly. I resolved this by using the code below: Options +MultiViews ...
0 votes
0 answers
49 views

URL Shows 404 but adding .php at the end displays

I have set up this website and it's working perfectly, however, extensions such as domain.com/dashboard will display a 404 but when I add .PHP at the back -> domain.com/dashboard.php it displays. ...

1
2 3 4 5
56