Questions tagged [htaccess]

Directory-level configuration file found mostly on Apache web servers

Filter by
Sorted by
Tagged with
1
vote
0answers
24 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
12 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
18 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
35 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
35 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
19 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
124 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
40 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 ...
0
votes
0answers
24 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
33 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
41 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
74 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
17 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
40 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
83 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
30 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
33 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
vote
1answer
33 views

How to add trailing slashes to links in my pages from .htaccess in addition to the redirects I've implemented?

I've recently appended the trailing slash at the end of the URL by using this .htaccess code: #add trailing slashes RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^...
0
votes
0answers
23 views

2 languages redirect htaccess

I have a one page website in 2 languages (root is empty): https://example.com/en/ https://example.com/pl/ All visitors using Polish language in browser should be redirected to: https://example.com/...
2
votes
1answer
41 views

403 Forbidden error for Wordpress login after whitelisting Cloudflare IPs in htaccess

I’m using Cloudflare nameservers and tried to whitelist Cloudflare IPs through htaccess file, but it results in a 403 Forbidden error for my Wordpress login. Here are the directives I used in ...
0
votes
0answers
12 views

apache .htacess redirect to treat root domain with or withought / as a single page not 2 page [duplicate]

I have developed a dynamic PHP website and code is written in core PHP (NO CMS or Framework used). When I am checking with SEO tools it is saying duplicate content for https://sattamatkaa.in/ and ...
1
vote
1answer
33 views

mod_rewrite rule for new pages that keep wildcard subdomains

I've read everything I could and can't figure this out. I need a simple page redirect that keeps the original subdomain. We have several stores on their own subdomains with identical product page ...
1
vote
1answer
28 views

Prevent apache from using machine host name

In our office, we have a public facing server whose machine hostname is server16. We want Apache to only respond to requests on server.example.com. We have a VirtualHost entry with ServerName server....
1
vote
1answer
22 views

How to rename multiple files using .htaccess

I need to rename many jpg files. For expamle: warszawa_1.jpg -> wars_1.jpg, warszawa_2.jpg -> wars_2.jpg I created in the .htaccess file something like that: Redirect 301 /img/warszawa_1....
1
vote
1answer
79 views

htaccess force HTTPS to main domain and all subdomains

I have a server with a main domain, and several subdomains. There is independent wordpress sites/installs on each of the subdomains, and also one on the main domain. (I know about multisite, but they'...
2
votes
1answer
38 views

Can I rewrite to a redirected URL using .htaccess file?

I have a page A. I want to have a page B which is served as a rewrite of page A using .htaccess. Is it possible to redirect page A to page B from .htaccess or is it going to go into an endless loop?
0
votes
0answers
12 views

Error caching static js files in my htaccess file. What does this error mean? [duplicate]

I have this in my .htaccess file: <IfModule mod_expires.c> ExpiresActive on # Perhaps better to whitelist expires rules? Perhaps. ExpiresDefault "access plus 1 ...
1
vote
1answer
42 views

Removing Some Content from website by giving 410 status code

I have some content to be permanently deleted from my website. This is a permanent deletion and I am planning to give 410 status code. I can very well return the status code in PHP page as header( "...
0
votes
0answers
31 views

Redirect 301 issue with URLs containing question marks [duplicate]

I'm trying to do some basic point to point redirects using 301 redirect 301 with a .htaccess. All is going well but there is one type of URL that is not happy. I'm trying to go from: http://www....
0
votes
0answers
14 views

How can I get rid of these outbound links slowing my YSlow score? [duplicate]

I'm trying to make my website faster and GTMetrix tells me that (among other things) these links are lowering my YSlow score due to Leverage Browser Caching not being enough. They're all third party ...
2
votes
1answer
56 views

How to stop cPanel messing with .htaccess and causing unexpected redirect

So I have many domains on one cPanel account, say filmstore.net, bookstore.com and sandwiches.org (the main domain). So I want to redirect anything.sandwiches.org to sandwiches.org, so I have the ...
1
vote
0answers
31 views

What does this code do? [closed]

I've been looking at ways to make websites more secure and in particular WordPress site and found a blog post with a few suggestions. Most of them I was already using but found this one with no ...
1
vote
0answers
129 views

Use .htaccess/SSH/Cpanel to prevent a specific part of a specific PHP script from being processed

I have a website built with MediaWiki CMS which I host on a CentOS based Apache "shared server environment" (SiteGround) in which I can partially control Apache by: .htaccess files SSH Some Cpanel ...
2
votes
1answer
59 views

How To Create An Exception, or or exclude certain files from a php-file-extension Snippet in .htaccess? this example failed

This is a .php file extension removal snippet, for displaying links online. RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] RewriteRule ^ %1 [R,L] This is where I make an exception to ...
1
vote
1answer
53 views

Serve all pages over https not just homepage

I want to serve all of my website pages over https, but currently my htaccess only serves the homepage over https. This is the code I have in my htaccess file: <IfModule mod_rewrite.c> ...
3
votes
1answer
48 views

Non-existent subdirectories of index.php do not return “404 not found”

My website usually correctly returns 404 not found errors if I enter names of documents or folders that do not exist. However, I have recently noticed something strange. The homepage of my website is ...
1
vote
1answer
35 views

How to deindex an URL with specific parameter?

While I was doing an audit of my website SEO, I found a warning for a page that is most of the time blank. Basically, this page serves for storing articles for visitors who would like to read their ...
2
votes
2answers
144 views

How can I create a dual URL system?

I'm looking for a simple trick Let's say I have a Wordpress installation and image resources in this URL http://example.com/wp-content/images/example.jpg I would like to have the possibility of ...
2
votes
1answer
36 views

.htaccess - RewriteRule for 404 and query

I am very new to this stuff. I have a website with these RewriteCond/RewriteRule directives. Options All -Indexes RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}...
2
votes
1answer
83 views

What should I do about penalized websites that have been 301 redirected to mine?

Someone is doing a negative SEO attack on my site 301 redirecting toxic sites to my site. I have done research and nobody online seems to have an answer. Would disavowing the domain doing the 301 ...
3
votes
1answer
155 views

Configuring .htaccess to block every request what not image in specified folder and subfolders

I have upload folder where registered user can upload files. How to block all http requests except .png .jpg .gif to upload folder and all sub-folders? Other than upload should not be affected. It ...
0
votes
0answers
20 views

Use .htaccess to prevent image hotlinking except for Google, Bing, Yahoo, and Facebook [duplicate]

Can anyone create a .htaccess hotlinking rule for me allowing Google all domains (.com, co.uk, co.in, .au etc.) + bing.com + yahoo.com + facebook.com I would do it using online hotlink htaccess ...
2
votes
1answer
30 views

How do I create clean URLs such that what is currently in a parameter goes in the path?

My url is http://localhost/store/product-detail.php?p=prod%name%test i want it to look like this http://localhost/store/prod-name-test or something like this as other stores do http://localhost/store/...
3
votes
2answers
160 views

How to prevent hotlinking for specific domains using .htaccess?

I'm being heavily spammed by image scraper sites. There are more than 150+ domains targeting my images & sending spammed links to my site. I just want to prevent hotlinking from them. I just want ...
4
votes
1answer
55 views

Need 410 error code for htaccess on Joomla site for a limited number of pages

I have a Joomla 3.9.13 site, using Gantry 5.4.31. I have a limited number of articles I want to remove from my site, and instead of returning a 404 error I want to return a 410 error. I am not a ...
0
votes
0answers
19 views

How to set up htaccess to redirect all URLS to new domain main page (no path)? [duplicate]

So I have domain http://example.com. I want to setup htaccess to redirect all of these variations http://www.example.com http://example.com https://example.com/111 http://example.com/222 ... ...
3
votes
2answers
117 views

How to set up htaccess to redirect all URLS to new domain?

So I have domain http://example.com. I want to setup htaccess to redirect all of these variations http://www.example.com http://example.com https://example.com/111 http://example.com/222 ... ...
4
votes
1answer
86 views

Link from a Wordpress page to a password protected non-Wordpress page on a subdirectory

I have a Wordpress site which contains a link to a non-WordPress (i.e. pure Html) page sitting on a subdirectory of the same domain. It all works fine at the moment but now I wish to password protect ...
2
votes
1answer
199 views

Google Sites: 301 Redirect broken links to the home page

Several months ago, I migrated my domain from GoDaddy to Google Domains and now use Google Sites. Several broken links from the old GoDaddy webpage highly ranked on Google Search persist. I would ...

1
2 3 4 5
30