Questions tagged [htaccess]
Directory-level configuration file found mostly on Apache web servers
1,685
questions
1
vote
1
answer
41
views
.htaccess redirect from HTTP to HTTPS and add canonical
I am having a few problems with Google search console not validating any of my self hosted WordPress blog pages and I have tracked it down to (I think!) a redirect from HTTP to HTTPS.
This is my ....
1
vote
0
answers
18
views
Redirect double-slash "//" URLs using a rewrite rule in the .htaccess file
Google Search Console is giving me the Duplicate without user-selected canonical error for URLs that contain an unnecessary double slash // in them, like:
https://university.edu/~user//dir/
To avoid ...
0
votes
0
answers
14
views
Error using nonce in .htaccess Content-Security-Policy (CSP) [migrated]
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 ...
0
votes
0
answers
95
views
How to block unwanted bot in Apache 2.4?
These rules work good in my .htaccess:
#https://workinnet.ru/de/wie-man-amazonbot-blockiert/#German language#
SetEnvIfNoCase User-Agent "Amazonbot" blocked_bot
<Limit GET POST HEAD>
...
0
votes
0
answers
12
views
Trailing Slash for home page redirect? [duplicate]
While redirecting a page to the homepage, is there any problem if I add a slash to the homepage in my .htaccess file? Currently the homepage doesn't have a slash in the URL.
0
votes
0
answers
49
views
Htaccess won't work with RewriteMap
When the URL link is changed in the administrative panel, and a new map is generated for Apache, I'm encountering an issue with the .htaccess file configuration and RewriteMap. In my Apache ...
0
votes
0
answers
50
views
Duplicate, Google chose different canonical than user after redirecting to HTTPS and Non-WWW via HTACCESS
I have redirected the www version and http version to non-www and https so the URL will be like https://website.com using the following .htaccess code:
RewriteEngine On
RewriteCond %{HTTPS} off
...
3
votes
2
answers
109
views
Building a webcomic: How to redirect URL to latest slug using htaccess?
I'm inexperienced with coding.
I have a comic that creates new pages as /?pg=pagenumber
I want visitors to be redirected to the latest page. So when they type: https://example.com they get redirected ...
0
votes
0
answers
29
views
SEO Impact: Rewriting image urls in htaccess
I'm currently looking to leverage Cloudflare Image Resizing on a sizeable Wordpress multisite network. Changing all the image requests across the site to reflect the Cloudflare URL is of course going ...
0
votes
1
answer
43
views
htaccess stops after reforming url before redirect
I want to be able to have the an URL be reformed in an htaccess file and redirect a file that is no longer present.
Taking this:
http://www.example.com/foo/thing.htm
and having this be renamed to:
...
1
vote
0
answers
43
views
How to redirect wildcard and non-wildcard differently?
My customer had a single WP site at example.com. This was changed so that on that address is only be a static page, a landing page, with an election to choose between two WP sites which locate at ...
-1
votes
1
answer
73
views
htaccess and redirects
I'm wanting my URL to resolve to https://example.com if the visitor is typing in the URL with http://www or http:// or https://www
Right now I have a redirect in my htaccess and it works but I get ...
0
votes
1
answer
95
views
Help with HTACCESS 301 Redirect to different site with URL parameters
I have two websites, elijahstreams.com (OLDSITE) and projectjustcause.com (NEWSITE).
I need ID-based URLS to forward from OLDSITE to SEO-friendly URLS on NEWSITE via .htaccess directives.
This is what ...
1
vote
2
answers
60
views
HTTPS site on Chrome with paid SSL showing as Dangerous
I built a WordPress STAGING site on projectjustcause.com domain. I have installed and tested paid SSL cert and it worked fine. When I added directives to APACHE 2.4 .htaccess file to forward all http ...
1
vote
2
answers
68
views
Is it possible to transfer an old domain to a new subdomain?
Is it possible to move an old domain to a new subdomain permanently without losing search engine rankings? For example, going from https://www.example.com/ to https://blog.newexample.com/?
0
votes
1
answer
30
views
Problem to detect security script like X-Frame through .htaccess file in WordPress and how to trace and find the problem?
I transferred my WordPress website from a hosting company to a virtual machine. I want to add some security scripts like X-Frame, CSP, and HSTS. Before that, I edited the .htaccess file from the ...
0
votes
0
answers
139
views
Can't Find a Solution for Removing Trailing Slash at End of Directory URL
Please help me get my URL folders to point to index.php without a slash at the end. I tried this guide, but all I get is a URL with the slash at the end of it. The computer displays the right page, ...
2
votes
1
answer
191
views
Bing site scan: Avoid Error 403 if index.html is missing the root domain name
I have a website with the following domain name:
https://example.com (there is no index.html in the root domain name)
I have the following redirect based on language detection in .htaccess:
https://...
0
votes
0
answers
125
views
Redirecting old domain to two new domains
The issue at hand is redirecting selected pages from the olddomain to the newdomain1 and newdomain2. Doing one domain is fairly straightforward, but it's different when handling two domains.
Any ...
1
vote
1
answer
195
views
htaccess redirect with negated conditions
Simple redirect in .htaccess works:
#Redirect 302 / https://domain.toberedirected.com
But the conditional one doesn't. I want that if the remote user IP address is in the list then ignore the ...
0
votes
1
answer
188
views
How to use mod-rewrite for SEO friendly get params?
At present the webpage accepts get params like this https://TripTale.in /details.php?id=AlphaNumericKeys
Which I want to make it look like https://TripTale.in /details/someTexts/AlphaNumericKeys
...
0
votes
1
answer
31
views
301 Redirect a domain to new domain and add extra subdirectory to the existing path
i want to redirect my old domain to new domain x.com - y.com
and also, my old domain x.com currently doesn't have sub directory in url
ex: x.com/news-today
for my new domain y.com having sub ...
1
vote
0
answers
138
views
Google is accidently indexing query string URL parameters and causing my website bandwidth increase
Google is currently indexing query strings URLs of my website. Google has currently indexed almost 112k URLs that all are duplicate version of other URLs causing my website to slow down and negatively ...
2
votes
0
answers
50
views
Redirect the bare domain to a subdomain and still make the bare domain appear to users to fix a CSP error that occurs when using the bare domain?
I'd be grateful for some guidance with URL redirects in the .htaccess files as I'm not sure how to handle (though I hope it's straightforward).
I've installed a site into a subdomain, let's call it ...
2
votes
2
answers
327
views
Edited my .htaccess file and now website is downloading, not displaying anymore
I made changes to my .htaccess file and now the website is not loading anymore. Instead, it just downloads a file called "download". This happens on Google Chrome, but on Safari the website ...
2
votes
1
answer
87
views
.htaccess rewrite does not work with adwords gclid passed to the final url
Have a problem with traffic coming from Google Ads.
A have a redirect roll that redirects
https://example.com/some-words-words-aktivitet/
to
https://example.com/index.php?mobile=1
(RewriteRule ^some-...
1
vote
0
answers
144
views
My wordpress posts wont get indexed/displayed anymore in Google image search
Suddenly my website seems to be locked out of Google image search.
None of the articles of the website get indexed when I search, however search console says the urls are getting crawled.
I have ...
3
votes
1
answer
286
views
Alternate page with proper canonical tag - htaccess rule
I have been receiving lots of canonical error messages from Google Search Console. Most of the time, the referring pages are my own pages and the urls are correct in the referring page.
Google is ...
7
votes
2
answers
6k
views
AH10411: Rewritten query string contains control characters or spaces
How to reproduce the error:
-- A space in my URL will trigger the error.
Observation of the error:
-- It seems to happen suddenly since around 3/10.
---- I did not upgrade my Apache version, but it ...
8
votes
1
answer
3k
views
RewriteRule started returning 403 Forbidden error
I have a website that uses a set of quite simple RewriteRules of the format:
RewriteRule ^p/(.*)$ /product.php?$1 [L]
All was working well and still is working perfectly fine on localhost. For some ...
0
votes
1
answer
118
views
Remove sub folder name from URL
http://example.com/portal/reports/data.php?id=2
In this URL I want to hide portal folder in the url/:
http://example.com/reports/data.php?id=2
How can I achieve this using mod_rewrite?
I used online ...
1
vote
2
answers
157
views
Is it possible to restrict the access to a website with a login/pwd tuple without having access to the Apache config?
I only have a web hosting solution which doesn't include a server config access, this is a mutualized solution.
I would like to try to allow users to access my website only if they have the expected ...
1
vote
1
answer
445
views
How can I redirect a PDF to home page?
I'm trying to redirect from an URL like this:
https://example.com/images/qr/brochure.pdf
to the home page of the site: https://example.com
I tried using this code in a .htaccess file, and added the ...
0
votes
1
answer
90
views
How can we redirect all pagination URL to main page
We want to redirect https://www.example.com/blog/category/mobile-application/page/2/ to https://www.example.com/blog/category/mobile-application/ or all blog category pagination to the main category ...
0
votes
0
answers
18
views
Check if old URLs that are redirected are receiving traffic and they are active [duplicate]
So I took over a web with almost 10.000 redirects created in .htaccess file which is ridiculous.
The domain is more than 15 years old.
I want to remove redirects that are no longer needed for the ...
1
vote
0
answers
22
views
Block specific C range of IP addresses [duplicate]
I can't find a good reference though my understanding is that ranges in an IPv4 address are:
a.b.c.d
I wish to block only the C ranges starting with 51.15.51.0 and ending with 51.15.142.255.
I have ...
1
vote
1
answer
138
views
Redirection of Spams hacked page 404 to 410 .htacess
My website has been spammed by hackers for maybe 1 year.
So now I have to update everything I think. And it seems that the page targetted by spammers is going to 404.
My question :
I tested this ...
2
votes
1
answer
133
views
.htaccess redirect php WHMCS cart ID
For WHMCS I am trying to redirect products to another ID and subdomain.
How can I create a .htaccess that will redirect
https://www.example.com/clients/cart.php?a=add&pid=17
to
https://clients....
2
votes
1
answer
65
views
Redirect 301 a URL already created by a rewrite rule in .htaccess
I'm creating SEO friendly URLs with rewrites in .htaccess.
Now I need to redirect (301) a couple of these rewrites, and have no idea how to do that.
These lines:
Options +FollowSymLinks
RewriteEngine ...
2
votes
3
answers
541
views
Why do I have to enter basic authentication credentials twice for WordPress with .htaccess?
I protect the wp-login.php file via my .htaccess file:
<Files wp-login.php>
AuthName "Admin-Bereich"
AuthType Basic
AuthUserFile /*path*/htdocs/.htpasswd
require valid-user
</Files&...
1
vote
0
answers
14
views
Is RewriteMod for WordPress site: site.ro -> site.com/?lang=ro possible?
I'm not much of a WordPress specialist - is it possible to redirect new domain to the same site, but with ?lang=ro query parameter so it shows the old site with selected language?
Result I want:
site....
1
vote
1
answer
59
views
WordPress doesn't identify the subfolder
I have a subfolder with a separate WordPress running on it. When I click on a link which should lead to the destination in the new website (the subfolder) it reads everything except the mentioned ...
0
votes
1
answer
283
views
Why . htaccess file is necessary?
Actually some hosting provider disable
. htaccess file in window hosting.
Is this necessary file?
If this file is necessary then how to enable it?
1
vote
1
answer
73
views
If .htaccess redirects domainroot to a localized start page, should the domain root (which should be canonical) be in the sitemap.xml?
When you host a webpage, e.g., https://mydomain.example and .htaccess already takes care of the rewrite from www to without www and from http to https and it is also rewriting with RewriteRule ^$ ...
4
votes
2
answers
68
views
How do I find if any website still links to one of my pages?
not to be confused, I'm not looking for backlinks check. I took over a site that has more than 10.000 redirects inside htaccess file.
Those redirects were made 2 years ago when the website platform ...
1
vote
1
answer
84
views
Website not working due to htaccess
My website was fine (apologies in advance for not being a webmaster or developer) until SSL was enforced through hosting platform - a 500 error code/page showing internal server error. Spoke to ...
4
votes
1
answer
234
views
Handling # uri fragments as regular requests
So I have a one-page website with multiple sections and IDs. Right now, in the nav, I have it going to #about to jump them down to a section with ID=about
But I want the user to be able to go to ...
0
votes
0
answers
99
views
htaccess: differentiate between directory and directory with query parameters
I have a little PHP framework like this:
?page=page-name
?page=page-name%slug=slug-name (in the case of plural list pages)
I'm trying to pretty her up.
/exercises → ?page=exercises
/exercises/...
4
votes
1
answer
59
views
Will changing URLs with .htaccess impact my SEO negatively?
Basically, I have URL like www.example.com/month/day/name-of-post.
What I want to do is to change the month/day to blog/month (or just /blog/) for continuity.
I have a WordPress and the pages are ...
0
votes
0
answers
28
views
Retain URL With Slashes And Redirect To File
This has probably been answered several times but I can quite find the exact answer im looking for, I've tried a variety of examples but none do what I need.
I'm trying to mask a URL to a one file ...