Questions tagged [htaccess]

Directory-level configuration file found mostly on Apache web servers

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

How to prevent a specific PDF file from being indexed by search engines in Wordpress?

In a wordpress multisite installation, I would like to block indexing of a specific pdf file using HTTP X-Robots-Tag response header using htaccess file. Any of the indications found in previous ...
0
votes
0answers
39 views

How To Fix 404 Errors On An Entire Site?

I have a PPC l client who recently re-designed their e-commerce site. The only problem is that every single old link that they had before is now a 404 error. They had a fairly healthy organic ranking ...
2
votes
1answer
23 views

htacces rules for mobile and desktop site

I have a site that stores an index.php for desktop computers and a mobile.php for mobile devices. Both files are in the same directory (say /var/www). As default the user accesses index.php and if ...
2
votes
1answer
64 views

.htaccess — Trailing slash and characters after file extension

I've got some weird usability warnings popping up in my search console for pages which don't actually exist on my site. It looks like someone is creating 100's of malformed links to my pages. Here's ...
1
vote
1answer
43 views

Clean URL's within subdirectories

I have a website with the following structure index.php contact.php about.html forum(dir) - index.php - thread.php What i want my htaccess to do Remove .php & .html extension, eg: when you ...
1
vote
0answers
22 views

How to fix duplicate title tags canonical for / vs index.html

I am confused, after scanning by an online SEO tool, it says: error duplicate title tags canonical; https://cleanmypc.co.uk and https://cleanmypc.co.uk/index.html I have in my .htaccess file ...
1
vote
1answer
44 views

Htaccess won't work with ajax/php

Sending ajax request by jquery doesn't working with htaccess. Works without htaccess. product_configurator.php -> fetch_data_p.php $.ajax({ url:"fetch_data_p.php", ...
1
vote
1answer
13 views

Htaccess Using RewriteMap with a text file

I can't use link with * Example - http://localhost/photo_gallery/public/show_c.html/color-1* The requested URL was not found on this server. The others work's color-3, wood, etc. generated map - map....
1
vote
1answer
38 views

.htaccess url rewrite remove 2 id

Is it possible to delete 2 parameters ID of the url & just show the number. Currently i have url like this: http://localhost/photo_gallery/public/product_configurator.html?prometheus_id=10082&...
2
votes
1answer
35 views

How can I redirect my URL to rearrange the order of subdirectories in .htaccess?

My current URL is example.com/example/{dynamic_id}/{dynamic_name}/static/1.html I want to redirect it to this, example.com/{dynamic_name}/example/{dynamic_id}/static/1.html I tried but failed.
1
vote
1answer
49 views

Url changing with htaccess

I have a web presentation with some typical url adresses. Now I need to add a rewriterule for a different languages, examples: domain/club -> do not change domain/club/path -> do not change ...
2
votes
1answer
40 views

Will deleting and re-upload my new site site help Google index it and resolve duplicate URLs that are now fixed?

I uploaded a new site with a domain name https://example.com (actually the domain consists of 3 words concatenated together). If i do a google search for those three words in Google, the site does ...
1
vote
1answer
52 views

Blocking bad bots based on useragent in apache conf

I am proposing blocking bad bots using the following code in /etc/sites-enabled/site.conf and I have a few questions. RewriteEngine On RewriteCond %{HTTP_USER_AGENT} useragent1|useragent2|useragent3 [...
4
votes
1answer
63 views

htaccess force https not working if there is not an URI

I've never worked with Apache, so I'm a completely newbie. I have a multihosting account on a provider website, where 3 domain are used. I want to force https connection on a domain, let's say example....
2
votes
1answer
38 views

How to Redirect URL with special Characters?

I try to redirect a special URL in .htaccess, as below: Redirect 301 /aor/%e2%80%9d https://www.example.com/outlook-repair/ But this seems does not work. I try to add quotes, as follows: Redirect 301 ...
2
votes
2answers
193 views

Block directory access with .htaccess rules does not work

I am trying to block access to a specific folder and all of its content. I use methods suggested on the Internet, but they do not work. This method does nothing: RewriteRule ^folder_name/?$ - [F,L] ...
1
vote
0answers
38 views

HSTS compatible .htaccess redirect from non-www to www that preserves URL path [closed]

UPDATE: The redirect actually does work! The site is a friends site and I was coming up with solutions and sending them to him. Turns out his website is running Joomla. After further troubleshooting ...
0
votes
0answers
51 views

Change of Address, Show Error in site 301 redirection on Google Console

I'm trying to use the Change of Address Tool to move a site to new domain. I've set up 301-redirects for all the pages including the home page. However i'm getting a 'Validation failed Failed one or ...
1
vote
1answer
40 views

.htaccess Rewrite Wordpress Subdirectory without breaking other subdirectories

So I have WordPress installed in /wp/ but I want all WordPress URLs to be rewritten to appear in the root directory. I currently have this working (see below) but I want to change my .htaccess so it ...
1
vote
1answer
34 views

Rewrite URL with ID to one file using .htaccess

I have "home" directory as: /var/www/page I need redirect: /var/www/page/index/product/id/9098890 Where 9098890 is the id of product. to one file: /var/www/page/script/index.php I want ...
2
votes
1answer
50 views

Redirect domain in CPanel without using htaccess so I can delete old domain

I have an old website that is being hosted on Apache/CPanel site. I'm being charged for hosting this site, even though it's being redirected to another site. I'd like to delete the hosting of the ...
0
votes
1answer
46 views

Htaccess 301 Redirect only not working on Windows 8.1

Here's the code: RewriteOptions inherit RewriteCond %{HTTP_HOST} ^old\.olddomain\.example$ [NC] RewriteRule ^ https://newdomain.example%{REQUEST_URI} [R=301,L] # BEGIN WordPress RewriteEngine On ...
2
votes
1answer
98 views

301 redirect with regex: how to match any file at top domain level (not in a subdirectory)?

I need to redirect URLs of all .dmg files at domain's top level to specific folder. By way of example: http://example.com/file.dmg to http://example.com/downloads/file.dmg I can't hard code the domain ...
1
vote
0answers
38 views

Subdomain forward with masking on Bluhost

I am trying to forward with masking a Bluehost subdomain (login.example.com) to another Bluehost subdomain (login.example.ca). I did the following; RewriteEngine On RewriteCond %{HTTP_HOST} ^login....
2
votes
0answers
30 views

Safari prompts for BasicAuth credentials on every request in WordPress admin area, but works fine on the rest of the site

I have a WordPress website which is in development, and is hidden behind a BasicAuth password prompt. My root level .htaccess file: AuthType Basic AuthName "Login Details" AuthUserFile /var/...
0
votes
1answer
35 views

.htaccess file location on server [closed]

Because I am using a shared server (Apache 2.4) and don't have root access, I uploaded an .htaccess file. As best as I can determine, the .htaccess file is not stored in the public_html directory, ...
2
votes
1answer
42 views

Apache mod_rewrite in .htaccess

This should be a simple question. Checked Google but it listed nothing helpful. I use WP on one of my sites and it already generates a mod_rewrite section with: <IfModule mod_rewrite.c> ...
2
votes
1answer
98 views

How can I limit .htaccess to current directory scope only?

I have something like this: Options -Indexes RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?path=$1 [NC,L,QSA] Order deny,allow ...
1
vote
1answer
53 views

Internal Server Error caused by rewriting [closed]

Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ $1.html [NC,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{...
1
vote
0answers
29 views

Remove PHP extension from URLs such that the URLs work with or without a trailing slash

My directory structure is - Assets - Dashboard - index.php - account.php index.php about.php verify.php What I basically want it to be: Remove the .php extension for example http://example.org/...
1
vote
2answers
49 views

How to redirect to same page for changing language via .htaccess config?

How to redirect to same page for changing language via .htaccess config? For example example.com/some-page/en example.com/some-page/de
1
vote
1answer
72 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
32 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/ (...
3
votes
1answer
32 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
57 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
164 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 ...
3
votes
1answer
46 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
49 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
27 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
145 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
42 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
38 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
72 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
125 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
50 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
20 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
2k 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
87 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
41 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
189 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
2 3 4 5
31