Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
3 votes
1 answer
411 views

How to match beginning of file name using htaccess

I am attempting to modifying my .htaccess file within a specific directory. If a web user attempts to find any file in this directory that may be named like the following options, I want them to be ...
klewis's user avatar
  • 133
1 vote
1 answer
182 views

Creating a .htaccess in a subdirectory causes rewrite rules in higher level .htaccess to stop working

Sorry if this has been asked/answered before, but I was not able to find an answer to this particular problem. If I create a .htaccess file with a simple rewrite rule, that rule works. If I create ...
KBM's user avatar
  • 13
1 vote
2 answers
467 views

Apache Rewrite Engine redirect all request to index.php

I have a PHP web application on a Apache Web Server. The path to to web application on the Server is: /var/www/html/intern/organisation/example_app The URL to the web application is: https://www....
Mario's user avatar
  • 11
0 votes
0 answers
221 views

Intercept HTTP POST response from Reverse Proxy in Apache

I have following configuration in my Apache server and requirement is to intercept HTTP POST request to /api/submit endpoint and trigger a CURL request to a remote URL before forwarding it to backend ...
user8373873's user avatar
0 votes
0 answers
150 views

Apache2 folders redirect to IPs

I have installed Apache/2.4.56 (Debian), a noip URL and severals LXC containers. I need to access to the web apps inside the LXC containers: example.com/app1 -> LXC container 1 (with Zend2) example....
Lethal's user avatar
  • 1
1 vote
1 answer
80 views

Apache VHost Redirect /dir/ to subdomain

I had applications running on the following variable links: www.example.com/topics/vardir/show www.example.com/education/topics/vardir/vardir/show www.example.com/literacy/topics/vardir/show www....
Josh Hawkes's user avatar
0 votes
1 answer
476 views

htaccess rewrite rule to a specific PHP page doesn't work

I have the following code in my .htaccess file, placed in the root of my Ubuntu 22.04 instance: Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{...
Frank Eno's user avatar
  • 101
0 votes
1 answer
38 views

apache2 mod_rewrite rule error (although i think i did everything correctly, and have exhausted google's searchresults)

this rewrite rule is not hitting it's mark :( RewriteCond %{REQUEST_METHOD} ^(GET)$ RewriteRule ^/wiki-search/(.+)$ NicerAppWebOS/index.php?app-wikipedia.org-search=$1 [L,END,PT,DPI] apache ...
Rene Veerman's user avatar
1 vote
1 answer
165 views

Edit .htaccess file to make file accessible

I was trying to make a WordPress plugin work, when I found, after hours of debugging, trial, errors and praying ancient Greek gods, that the plugin did not work because it was impossible for the ...
Life after Guest's user avatar
2 votes
1 answer
368 views

.htaccess return error if no RewriteRule meets the request

I'm trying my hands on writing a simple REST API and am currently trying to properly configure my .htaccess file. What I'd like to achieve is the following: have RewriteRules to direct requests ...
traxx2012's user avatar
  • 123
1 vote
0 answers
161 views

Apache Rewrite Based on Query String

I'm trying to detect the presence of a particular name/value pair in the query string and, if it exists, do a thing. I'm trying to do this in a conf file that's stored in conf-available/ and after ...
Rob Wilkerson's user avatar
2 votes
3 answers
1k views

Apache on debian don't redirect http to https correctly

Debian 11 config file: /etc/apache2/sites-enabled/000-default.conf <VirtualHost *:80> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} ...
Ishayahu's user avatar
  • 187
0 votes
0 answers
1k views

Apache 2.4.52 HTTPS Rewrite no longer works on Ubuntu 22.04

I have been forcing HTTPS upgrade through mod_rewrite for years on Ubuntu 18.04 LTS servers. I recently upgraded a few of these servers to Ubuntu 22.04.1 LTS to ensure the latest security and Apache ...
Nick Bedford's user avatar
1 vote
1 answer
882 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 ...
markbarabus's user avatar
1 vote
1 answer
187 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 ...
user18571's user avatar
2 votes
1 answer
2k 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/...
Ehsanai's user avatar
  • 21
1 vote
1 answer
368 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....
Pouyan Danesh's user avatar
1 vote
0 answers
377 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 ...
Bob5421's user avatar
  • 429
3 votes
2 answers
1k 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 ...
Jayreis's user avatar
  • 145
0 votes
1 answer
931 views

Redirect all pages to non www and one page to www

I want to redirect all my internal pages (eg: example.com/about) to their non-www version but I want my homepage (https://example.com) to redirect to its www version (https://www.example.com). I ...
Excellent Exim House's user avatar
0 votes
0 answers
200 views

Apache2 behind NGINX: MOD_REWRITE only works without HTTPS

For days I can't get my head around the following problem: We have an application (Faveo) which has two requirements for going through the setup wizard: HTTPS & MOD_REWRITE. Faveo is running on ...
HeadKnockr's user avatar
1 vote
1 answer
736 views

How to make mod_rewrite force a redirect?

I have a need to temporarily redirect my website to a static version hosted on Cloudflare. The current site is a Wordpress site hosted at Ionos and Wordpress seems to be doing a 301 redirect from ...
Darrell Brogdon's user avatar
0 votes
1 answer
785 views

Apache, redirect for a moved directory

On our webserver a directory has been "copied" from one location to another. Now the original location is gone however I am receiving requests to provide a redirect to the new location. I ...
Chris Woelkers's user avatar
0 votes
1 answer
673 views

Apache2 mod_rewrite seemingly not doing anything

I'm having difficulty getting mod_rewrite to work in Apache2 on Debian 10. I enabled the extension with a2enmod rewrite systemctl restart apache2 And had no errors and can see the module in apachectl ...
TheLovelySausage's user avatar
0 votes
1 answer
181 views

Apache2 Virtual Host Proxy Forward

Hi all I am trying to use a virtual host to forward streaming.fusion.tk to my internal emby server form my webserver. I have setup a config file called streaming.conf in /etc/apache2/sites-available/ &...
Fusion's user avatar
  • 11
1 vote
1 answer
81 views

How to load requested file from sub-directory without rewriting base

Utilizing .htaccess rules, I'm attempting to load a file from within a sub-directory while keeping the frontend URL unchanged if both the domain and file path match criteria. Example of URL: example....
sparecycle's user avatar
4 votes
1 answer
2k views

htaccess rewrite /dir/*.jpg to /dir/webp/*.webp only when webp file exists

I'm trying to rewrite all website files (*.jpg|*.gif|*.png) to *.webp in a subdir, but only when the *.webp file exists. Previous and new files have the same name, only changing the extension and *....
Diego Flores's user avatar
1 vote
1 answer
482 views

After installing script all subdomains go to the main domain

I have a main domain www.example.com. and the following subdomains under the main domain support.example.com test.example.com Previously both subdomains are working fine. But after installing a PHP ...
srisree's user avatar
  • 11
0 votes
1 answer
73 views

How to redirect search.php?query=test&search=1&s=1 to /query/test

I have tried other things, but I cannnot get it to work, when I go to the main website, (index.php is just a include of search.php) it will send me to this /query/search.php/search.php/search.php/...
Nate Sturtz's user avatar
6 votes
4 answers
5k views

Apache: Return static string for location

For a .well-known path, I want to return a static JSON file/string. With nginx, this seems to be possible without creating that file by specifying the content in the configuration file: location /....
anonymus1994.1's user avatar
2 votes
1 answer
2k views

Forwarding Apache SSL-Port to Web-App on localhost

I'm struggeling for days now to route a subdomain with SSL to a local running vue app, specifically the directus admin ui. I've done this before, like with the tool monit, and it worked like a charm: &...
sagerobert's user avatar
1 vote
1 answer
342 views

Space in value part of RewriteMap

This question is related to Apache RewriteMap with URLs containing space doesn't work, but in this case the issue is a space in the value part of the map, not the key part. Say I have this entry: /...
dorian's user avatar
  • 437
0 votes
2 answers
134 views

Mod-rewrite Port in Apache2

I'm playing with home assistant (HA) in docker on Ubuntu 20.04. HA is hosted on port 8123. HA does not support subpaths, ie. it is hosted at MYDOMAIN.duckdns.org:8123 rather than MYDOMAIN.duckdns.org:...
EncryptedWatermelon's user avatar
0 votes
2 answers
812 views

RewriteRule conflict and trailing slash

We are migrating a website to our cPanel infrastructure. The customer hosted the website on his own infrastructure using Nginx. He sent to us his Nginx configuration files and we converted them to ...
Deeh's user avatar
  • 131
1 vote
1 answer
1k views

Apache VHost redirect aliases to HTTPS

I'm trying to do Virtualhosts on my "playground" VPS. I need it to redirect 3 or more domains to the main one. Also it should redirect HTTPS, Lets Encrypt is configured and working well. In ...
sjiamnocna's user avatar
1 vote
0 answers
575 views

Apache mod_rewrite P flag is rewriting URL unexpectedly

I've recently received a request from the site owner to redirect our base domain to a specific landing page on a subdomain, which is working just fine. The problem is that he wants the URL to remain ...
Justin Folvarcik's user avatar
1 vote
0 answers
2k views

How can I configure a reverseproxy (at /) and a Laravel project (at /backoffice/) running in the same subdomain?

I'm trying to configure on Apache a subdomain that should: Serve a PHP Laravel app if the request starts with /backoffice ReverseProxy to a node app otherwise. I can configure the reverse proxy and ...
My Quid Pro Quo's user avatar
0 votes
3 answers
3k views

How can I return 404 for specified existing file in apache and nginx?

I need to return 404 error for some specified files like 'config.php' . How can I do it with '.htaccess' in Apache? And in nginx without htaccess? Thanks.
Misha Markov's user avatar
5 votes
2 answers
4k views

Apache2 mod_substitute not working in <Location>

I have a working Reverse Proxy that is active only on a specific Location in my site, in this case for example: www.example.com/reverseproxy/site1 I am reverse proxying site1. I want to replace some ...
Paul_Rent's user avatar
1 vote
2 answers
1k views

Handling both 301 redirects and internal rewriting in .htaccess

I want to do three things on my website: Redirect users with a 301 to the HTTPS version of the site when they access the HTTP version Redirect users with a 301 to the "no-www" version of the site ...
Ailothaen's user avatar
1 vote
1 answer
1k views

How to redirect from document root to a folder with apache2 mod_rewrite

I have Apache2 on Ubuntu serving several hosts. Some of the hosts have Website and API parts and some folders like uploads which should be kept outside of the document root. I would like to organize ...
yaugenka's user avatar
  • 115
0 votes
1 answer
15k views

Solved - 500 Internal Server Error Apache, htaccess redirect

So, when i visit a page that is not existing on the main domain www or not i just get the normal 404 error, however when i visit it on a subdomain like dsfds.test.com i get the error 500 and in the ...
Elmond's user avatar
  • 5
1 vote
1 answer
923 views

Apache2 wildcard alias

I have the following wildcard vHost: <VirtualHost *:80> ServerAdmin [email protected] ServerName autodiscover.*.* ServerAlias autoconfig.*.* RewriteEngine On ...
Tim Altgeld's user avatar
2 votes
1 answer
477 views

How to "convert" htaccess rules into nginx rule?

I would like to "convert" this rules into an nginx rule. I think the location block is the right place, but my solutions doesn't work. Options -Indexes RewriteEngine On RewriteCond %{DOCUMENT_ROOT}/...
sareew's user avatar
  • 23
1 vote
1 answer
1k views

Recommended htaccess breaks all static content

I am struggling to get my website's CSS, IMG and JS resources to show. My website has this structure: root classes templates public images scripts styles index.php ...
Jimmy's user avatar
  • 269
1 vote
1 answer
324 views

mod_rewrite suddenly not working, ONLY for incoming POST requests from Foursquare API

I have an endpoint on my website where I receive push notifications from the FourSquare API. The endpoint is: https://www.example.com/auth/foursquare/ On the server itself, the source file is: /...
J23's user avatar
  • 113
0 votes
1 answer
178 views

Using Apache2 mod_proxy to different server while keeping .htaccess rules somehow working

I am trying to move a part of my website to an external server. I want this part to be accessible through a subdomain, while still being able to apply RewriteRules (doesn't matter whether thats done ...
VampireSilence's user avatar
2 votes
1 answer
519 views

apache2 Path rewrite to Get Parameter - Make Slashes work

The following is my current .htaccess file. If I open https://example.com/test and it doesn't end with one of the endings specified in line 2, it will open https://example.com/index.php?url=test ...
OfficialCRUGG's user avatar
0 votes
0 answers
39 views

Apache mod_rewrite fails http > https

I'm trying to redirect all http traffic for www.example.com to https://www.example.com, here's my apache2 config: <VirtualHost *:80> ServerAlias example.com *.example.com ServerName www.example....
batflaps's user avatar
  • 199
0 votes
0 answers
249 views

Rewrite URL to CAPITALIZE one word

In an attempt to preempt all of the comments I'm surely going to get telling me that this is a terrible idea and that it's bad for SEO... I fully understand the repercussions of what I'm asking. ...
spamGoblin's user avatar