Questions tagged [htaccess]

Directory-level configuration file found mostly on Apache web servers

Filter by
Sorted by
Tagged with
1
vote
1answer
31 views

Apache Rewrite Rule www to non-www + http to https + add trailing slash

I really need the following 3 features of my website: www to non-www HTTP to HTTPS force trailing slash at the end of the URLs I have a current implementation but I face a very bad bug. When I ...
0
votes
1answer
31 views

How to set default page, but keep URL extension?

I am trying to set {mydomain}/forum to be the default URL that people are brought to when they go to {mydomain}. I have this working, as in my .htaccess I wrote DirectoryIndex index.php?route=/forum/ (...
0
votes
0answers
19 views

Error when get id from url using .htaccess [closed]

I tried to create a file .htaccess to my page to clean the URL, but the problem when I want to get the id from the URL it shows an error message: Notice: Undefined index: id Any solutions? Here is ...
0
votes
0answers
30 views

Correctly defining Internal Redirect [closed]

My website always used to be directly in the root directory of the web server. Some time ago, I copied there the wordpress folder and made a new website. So the structure looks like that: [1] index....
0
votes
0answers
8 views

how to restore a tumblr draft? [closed]

I had this whole long draft of something important on tumblr, and then my phone died. When I turned it back on, the draft was gone and all that was left was an earlier draft, with only a fourth of my ...
3
votes
1answer
21 views

Drop and expire all cookies with a specific prefix

We're running a WordPress site with WooCommerce. A third party plugin was injecting (sbjs_*) cookies into our site to track purchases and provide us with additional reporting. Unfortunately, something'...
2
votes
1answer
55 views

Converting nearly 200 redirects into redirectmatches

I have close to 200 redirects that I would I to bring down to maybe a few dozen. Most look like the following. Redirect permanent /Fandom/Fictional_artifacts.pl /Fandom/index.pl?page=Fictional+...
3
votes
1answer
35 views

htaccess redirect root domain to subdomain with exceptions

i m using wordpress and want to redirect my root domain to a new subdomain and ignore urls that contains a certain string http://www.example.com/post.html To http://subdomain.example.com/post.html ...
2
votes
1answer
33 views

How do I redirect traffic only if being accessed from a specific port?

My website, https://coolkids.gq, has a Minecraft server hosted on it as well as a web server. It hosts both Bedrock and Java versions of Minecraft (unrelated) and I’ve figured out how to do the Java ...
1
vote
2answers
44 views

How to redirect some URLs to another local port with .htaccess?

I have the .htaccess file in the root public_html directory. It contains the following: Options -Indexes Redirect / /dali RewriteEngine on RewriteRule ^api/(.*[^/])/?$ http://%{HTTP_HOST}:5000/$1 [R=...
1
vote
1answer
21 views

convert htaccess to nginx [closed]

I want to convert this htaccess code to nginx. <ifModule mod_rewrite.c> RewriteEngine On ## Application Handler RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-...
1
vote
1answer
45 views

How to block access with certain string in the URL?

My site used to have a SEO hack. Although I have reinstalled the website, the attacker is still trying to access these URLs via Google or direct: /404.html?page=/wp-content/uploads/2020/03/... /wp-...
2
votes
1answer
39 views

Configure Apache to show a custom page rather than my host's default when a user cancels logging in via basic authentication

I have a protected directory on an hosted IONOS server. It correctly works when the correct credentials are entered, but when a user hits cancel, it redirects that user to the hosting provider's promo ...
1
vote
2answers
35 views

All pages are not being redirected to HTTPS when accessed using HTTP

I'm running a Wordpress blog that has an issue with HTTPS redirect. Except home page, no other URL is being redirected to HTTPS if you visit via HTTP. I want to redirect all HTTP traffic to HTTPS. ...
2
votes
1answer
65 views

How to disable .htaccess file using JavaScript?

By the way, the .htaccess was already enabled to my main directory. Is there any way to disable it using JavaScript? to my client-side? I was just curious about how my files are being secured. Thanks ...
3
votes
2answers
108 views

Can't get rewriterule substitution to work

I am trying to use Apache rewrite to turn something like https://www.example.com/sub/?v1=123&v2=456 into https://www.example.com/sub/?v1=789&v2=456 i.e. changing v1 to a specific value ...
2
votes
1answer
48 views

Can I create a keyword subdirectory for my home page to help SEO?

My website consists of an English-language Homepage (my index.html file), and a German and Russian translation of this page (de.html + ru.html), which are accessible through a button on the top-right. ...
-1
votes
1answer
18 views

Redirect https alias to http main domain (it is showing no private connection error)

Redirect https alias to http main domain (it is showing no private connection error) I have one domain alias www.domain2.example The main domain is www.domain1.example When someone enters to www....
0
votes
1answer
56 views

How to manually add expire header for google fonts css files? [duplicate]

i am trying to boost my website, but when i look it on gmetrix it says following statement There are 6 static components without a far-future expiration date. https://fonts.googleapis.com/css?...
5
votes
1answer
86 views

Is it good to go live with 302 first and then change it to 301 if everything works perfect

I am in the process of removing duplicate content (or URLs) issue on my website. There are hundreds of similar content links on my website where both URLs one without trailing slash and one with ...
2
votes
1answer
39 views

Duplicate content after moving from http to https

I move my wordpress blog from "http" to "https". I generate a sitemap that contains canonical urls with "https" and submit it to GSC. I used "rel=canonical" tag in all blog post urls. I also implement ...
2
votes
1answer
49 views

1&1 Ionos hijacking my error pages

I have a website hosted by ionos (formerly 1&1), they have an annoying "feature" (*) whereby an incorrect page request is hijacked and sent to a third party. The source code for the page I'm ...
1
vote
1answer
23 views

Sharing .htaccess files between directories on a server

I have a webserver with thousands of directories. Some need to be internal only, some need to reference specific IP addresses, some are public. These .htaccess files change from time to time with IP ...
1
vote
1answer
19 views

how fix rewrite rule conflict

I am using following rewrite rule and its working fine : 1) RewriteRule ^([^/]*)/?([^/]*)/?([^/]*)/$ estates1.php?pageNum_Clusterb=$3&estname=$1&location=$2 [L] but when add second code in ...
2
votes
1answer
35 views

htaccess Redirect Using Regex

I have 2 redirects that work fine: Redirect 301 /namedeal/ca_domain_name.php /namedeal/cheap_domain_name.php Redirect 301 /namedeal/ws_domain_name.php /namedeal/cheap_domain_name.php I want to be ...
1
vote
0answers
14 views

Redirecting to new domain page by page [closed]

I'm trying to redirect a domain to another one. Because of SEO concerns I've made a list of all the pages indexed in Google and for each one I decided where to redirect to. My .htaccess looks like ...
1
vote
1answer
15 views

.htaccess redirect to “410 Gone” status for URLs containg one letter + word “shop” after domain

After I recovered Drupal 7 site from malware attack I end up with lot of links pointing to (previously) spam content like this: https://www.example.com/lshop/puma-rihanna-c-449/?zenid=...
1
vote
1answer
27 views

change DirectoryIndex file for subdomain

I want two languages on my website - one french-specific website, and one in english for broader purposes (and no automatic translation). For maintenance reasons, I'd like to not duplicate images and ...
1
vote
1answer
41 views

.htaccess to redirect URL with specific query-string, to a different domain, maintaining the query-string

What I wish to do I have one particular URL I need to redirect using .htaccess, based on a specific value being present in the query-string. A 301 permanent redirect header being sent to browser (...
2
votes
2answers
67 views

How to Confirm that My Site is Not Indexed?

I want to prevent my site from being indexed and listed by Google. So I follow the instructions in https://yoast.com/prevent-site-being-indexed/ and add: Header set X-Robots-Tag "noindex, nofollow" ...
2
votes
1answer
37 views

Redirect URL via htaccess unique destination for subdirectories

I am trying to redirect URLs of a old Perch CMS to a custom CMS like this: Redirect /sites/praxis/ http://example.com/_Unser_Cabinet Redirect /sites/praxis/sites/chiropraktik http://example.com/...
1
vote
1answer
42 views

htaccess 404 code does not trap an incorrect URL path (with a / in the string [duplicate]

I have a simple 404 redirect in my .htaccess file: ErrorDocument 401 /404.htm ErrorDocument 404 /404.htm RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://hypnosis-retreat....
1
vote
0answers
29 views

Website was not redirect from non www to https+www

I'm currently doing www+https redirection where I hope that my website able to redirect from http://example.com to https://www.example.com but it does not work even I have added redirection in ....
1
vote
0answers
14 views

SEO Rewrite , URI Without .php Extension To file [duplicate]

I have website with this output Link : https://domain1.net/estates.php?estname=XXXX&location=YYYYY I want change it to : https://domain1.net/XXXXX/YYYYY I try it with following rewrite rule : ...
0
votes
0answers
21 views

Using .htaccess to map a random path to a private directory

I am trying to implement a zero downtime deploy strategy for a static website using an .htaccess file. I'd like to access at http://example.com/__staging__ the staging enviroinment redirecting ...
3
votes
1answer
43 views

How can I allow hotlinking between my own sites

I have several sites hosted on a Bluehost server. I would like my sites to be able to use each others' images. In other words, I want to let my sites hotlink images from each other. There is an ...
2
votes
1answer
37 views

Apache .htaccess Redirect and RedirectPermanent directives do nothing

I am trying to do a very simple redirect for an entire web site using instructions from sites like this and this, and several others that say the same thing. I am using Apache. My .htaccess file ...
3
votes
1answer
28 views

301 redirect rewrite query string in .htaccess [duplicate]

I am trying to perform a 301 redirect in .htaccess and I need to remove the query string ?view=full. Here is what I have that is not working: RewriteRule ^/contact/?view=full$ /contact/ [R=301,L] I ...
5
votes
1answer
146 views

Redirect all URLs exactly except one URL that must be redirected to a different URL

I must to change domain from example.net to example.com. To redirect all URLs exactly (www and non-www) I use: RewriteEngine On RewriteCond %{HTTP_HOST} (w*)example\.net$ [NC] RewriteRule ^ https:/...
3
votes
1answer
45 views

Hide the subfolder from appearing in url

I want to move from www.example.com/_/randomfolder to example.com/randomfolder. It should acces the contents from /_/randomfolder but should show example.com/randomfolder. What I have tried: Trial 1 ...
0
votes
0answers
35 views

You configured HTTP(80) on the standard HTTPS(443) port! [duplicate]

I currently have a website which runs under https and works with no issue and I've tried to do something on my .htaccess file so that when I try http://example.com it will redirect to https://www....
2
votes
1answer
34 views

How to redirect all that URLs that ends with “-2” to the same link without “-2”?

I have an comparison website based on woocommerce and I have the following problem. I have 1 product from 2 vendors: Vendor 1: https://example.com/lista/ceas-accurist-signature-7220-classic/ Vendor ...
1
vote
1answer
60 views

How to check a specific domain request with HTACCESS and add some query string?

Is it possible to check a specific domain request with HTACCESS and add some query string? Actually my entire task wants to pass some cookie values as URL parameters if a specific domain is requested....
0
votes
0answers
17 views

Can I use REGEX to 301 a URL with extra characters at the end? [duplicate]

I've just set up PHPlist to manage my email subscribers. When folks opt-in, they're taken to this page: https://www.example.com/lists/?p=subscribe&id=1 I'd like to redirect them to a custom ...
2
votes
1answer
75 views

set header 410 for random generated folder path

I have thousand of error URL with patterns like this https://example.com/feeds/74750882288885xxx/comments/default where 74750882288885xxx is a random number, I need help to set this URL to be 301 ...
1
vote
1answer
22 views

Are these lines doing anything in my .htaccess or can I take them out?

After migrating a site to a new server, I'm cleaning up my .htaccess file. In between my browser caching instructions and the super cache plugin instructions, I found this: <IfModule mod_expires....
2
votes
1answer
99 views

redirect to default language directory if no language have been selected - .htaccess

basically what i have in my .htaccess is couple of lines to detected the selected fake*sub-folder language requested in the URI and redirect it automatic to ?lang=(selected language) RewriteEngine ...
2
votes
1answer
296 views

mod-rewrite - sending any URL with “.php/” to 404

I have a substantial number of rewrite rules in place for a variety of reasons such as: disallow indexes, set custom error pages, force non-www, https, strip trailing slash, redirect index.html or....
3
votes
1answer
31 views

.htaccess rewrite rules for nonsense URLs

I have a number of rules governing the URLs on my main website & it's a pretty nice setup. There is an unintended consequence that has come up though. My latest addition cleans up a bunch of 500 ...
1
vote
1answer
35 views

How to remove slash from directory when there are more rewrite rules in the subdirectories on Apache?

I've an Angular applicaion in multiple languages. After the build process there exist a distribution for each language. These are put onto the server in locale directories: /en/index.html /fr/index....

1
2 3 4 5
30