Questions tagged [.htaccess]

Directory-level configuration file found mostly on Apache web servers

Filter by
Sorted by
Tagged with
0
votes
0answers
13 views

Apache Rewrite: Redirecting file based on domain requested

I currently have 2 websites, lets call them alpha and beta. alpha has a few subdomains, like domain1.alpha.com, domain2.alpha.com, and etc. I currently have set up a redirect that redirects all ...
0
votes
1answer
24 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/...
0
votes
2answers
25 views

Apache .htaccess set a header if Request URI does not exactly match a desired value

Goal: using a .htaccess file in /directory/, if request URI does NOT exactly match "/directory/" then set a header. For example, the header SHOULD be set if the request URI is "/...
1
vote
1answer
61 views

Issues with Require IP on Apache 2.4 and Ubuntu 20.04 server

I have setup a subdomain (staging.callkneehill.ca) on my server and have created a .htaccess file with the following parameters: <RequireAny> Require ip 70.65.194.109 </RequireAny> ...
2
votes
1answer
46 views

How to get line number of error that .htaccess apache2 is reporting in /var/logs/error.log

I get a internal server error after adding redirects to .htaccess - I've added 600 of them. I check /var/logs/error.log [Wed May 12 16:26:02.600394 2021] [core:alert] [pid 8071] [client 127.127.127....
1
vote
1answer
36 views

PHP processing pages for forms not following line with rest of files

I'm a web developer hobbyist. I'm over 50, never had a true web dev job but like to tinker in my spare time for fun. That said, I have a web site hosted by Bluehost that I wrote with PHP from scratch. ...
0
votes
0answers
15 views

Browser not rendering css and JS and images

0 I'm using: Ubuntu 16.04. Apache 2.4 php73-php-fpm on my dev server. I managed to get it so I can specify a handler and it will put that vhost on the correct PHP version, however CSS and JS seem to ...
0
votes
1answer
17 views

Apache 410 a URL Without Affecting Sub Paths

I'm trying to kill a URL, so in my .htaccess file, I put: Redirect 410 /my-path It works. If I try to visit: https://www.example.com/my-path I get: Gone The requested resource is no longer ...
2
votes
1answer
33 views

.htaccess not working - on add on domain

The original domain files are under /home/account/public_html, the add-on domain is /home/account/add-on-domain. Both sites have a .htaccess file, all the same, apart from the domain names, both are ...
-1
votes
0answers
29 views

Can I use .htaccess to make permalinks to sub-pages?

I have a bunch of pages that I'd like to be accessible with simple URLS without having to keep them in my webhost's root folder. I put these pages into a subfolder called my_pages and put the ...
0
votes
1answer
33 views

.htaccess redirect from SSL root domain to another subdomain with different SSL causes NET::ERR_CERT_COMMON_NAME_INVALID

I need help to figure this out. I have two local, separate webservers 192.168.11.5 (https://www.example.com) and 192.168.9.14 (https://project.example.com). Each has separate non-wildcard SSL ...
1
vote
1answer
31 views

How do I exclude my sitemap from httacess redirect?

I want all urls to be redirected, except my sitemap xml file in the root directory. The htaccess should allow https://old-domain/xml.xml to resolve with HTTP 200, but it is still redirecting to the ...
1
vote
1answer
24 views

Redirect the document root and a specific page only to another domain

Might sound confusing, but what I want to achieve is this: If the user visits: www.mydomain.com (with or without www.) transfer them to: www.myotherdomain.com/welcome-old-users At the same time, I ...
1
vote
1answer
41 views

.htaccess redirect based on the visitors host name, not IP address

I have done several attempts to figure out how to redirect visitors from the visitors hostname to some other place. I know with IP this works: RewriteCond %{REMOTE_ADDR} ^185\.93\.180\.* [OR] ...
1
vote
1answer
58 views

Apache Do Action Only If Path Contains

I'm using the following in an .htaccess to remove the extension from .php files: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] It works great, but how can ...
0
votes
0answers
23 views

multiple htaccess redirects to a new domain

I'm trying to redirect an entire domain over to another domain while also redirecting a couple of specific pages to specific locations. I also want to preserve www and https on the original domain to ...
1
vote
1answer
57 views

Apache rewrite causes server error 403 when genuine directory exists after extension removal rewrite

I've spent a couple of days now trying to create a specific rule set that will allow me to remove .html extensions from all the files in the directory and present neater URIs. I'm using a .htaccess ...
1
vote
1answer
48 views

Apache .htaccess - If directive to evaluate if home is the current page

I'm just trying to set a header if the loaded page is home (/), however, I can't manage to do that. What I've tried: #let's find var value - its echo / on the header PassEnv REQUEST_URI Header always ...
0
votes
1answer
46 views

Apache Redirect with OR Operator

How can I use the Apache OR operator to redirect several paths to one URL? E.g.: RewriteEngine on RedirectMatch 301 /foo || /foo/bar || /das.html https://example.com/ext/ddy/$1 Thanks for any help.
0
votes
1answer
25 views

Why is my .htaccess and .htpasswd not working

I have .htaccess and .htpasswd in the directory that haves png files that I want to protect. .htaccess AuthType Basic AuthName "Co to za nielegalne grzebanie w plikach, juz dzwonie na milicje....
1
vote
1answer
29 views

.htaccess Redirect 301 - Single pages work fine, homepage doesn't

I'm trying to redirect some specific pages to the new ones on my new site (these redirects work fine) and, finally, my homepage OR (even better) my homepage and all the pages which I didn't redirect ...
0
votes
0answers
32 views

apache (httpd) - How to set rewrite URL [duplicate]

I have a new website on Nette Framework, the problem is that the old website had URLs in the form: https://example.com/Questions/ https://example.com/Tags So all over the internet there are backlinks ...
1
vote
0answers
10 views

Public WordPress Website unaccessible from inside active directory with same domain name, but simple html file is accessible

a client uses the same corporate domain for his internal network / office365 installation as for the public website. The website and domain are hosted on a shared host, the site is serviced by me. ...
0
votes
0answers
30 views

My .htaccess causes 'redirect error' in Google Search Console, or a bug?

I'm having an issue with Google Search Console. It seems it can't redirect my pages properly, so in Coverage it returns some 'redirect errors' when it shouldn't. Let's say the link: https://example....
1
vote
1answer
36 views

Difficulty accessing folders .htaccess

I need to migrate a site running on Prestashop 1.6.1.10 to the latest version. I have a problem: I uploaded the new version to a new folder called shop, but I can't access it due to .htaccess. Here is ...
0
votes
0answers
34 views

.htaccess file hacked [duplicate]

How can we protect our htaccess file? This code has appeared there several times now: (inserted by hackers) RewriteBase / RewriteCond %{HTTP_USER_AGENT} (google|yahoo|msn|aol|bing) [OR] RewriteCond %{...
1
vote
1answer
34 views

.htaccess order deny,allow rule not working Windows

i have two .htaccess setup, One in the htdocs Main Folder with a .htpasswd file attached thats what it looks like rn ErrorDocument 404 /index.html AuthName "Protected Area" AuthType Basic ...
1
vote
1answer
40 views

Bad Request from RewriteRule after putting <If> Directive

I am building .htaccess for both localhost and godaddy when I stumbled upon this issue. RewriteEngine on SetEnvIf HOST ^localhost$ LOCAL=/company SetEnvIf HOST ^((?!localhost).)+ LOCAL=/ <If &...
0
votes
0answers
34 views

Redirect to magento 2 store in htaccess

I'm using SetEnvIf Host to redirect users to the correct magento store depending on the domain name. This works perfect for https://www.domain.co.uk, http://domain.co.uk and http://www.domain.co.uk. ...
0
votes
1answer
21 views

How to erase “about:blank” from URL with a RewriteRule?

Want to delete the about:blank from a URL www.example.com/camera/about:blank. How can I do this with .htaccess? I tried RewriteCond %{QUERY_STRING} (about:blank) [NC] but it didn't work.
1
vote
0answers
77 views

Redirect/Rewrite for directory if it contains a certain file extension inside

I have been stuck on this issue and have not been able to find a solution. I am using Apache 2.4.41. I am attempting to create a RewriteRule on a site if the currently viewing folder has any files ...
1
vote
1answer
22 views

.htaccess redirect root to i18n content

I'm facing problem with .htaccess and have not idea how to solve it. Our webpage is exposed on two domains: example.de and example.com. I would like to redirect user to i18n content when user request ...
1
vote
1answer
28 views

How can i write a simple rewrite rule in htacess for a file in the sites root directory?

Ive been trying to get my sites htacess to provide effective rewrites for my filepages but im doing something wrong. My directory structure is very simple. All my files are in the root folder. So ...
0
votes
3answers
53 views

NGINX + RegEx redirect: http://sub3.sub2.sub1.domain ---> https://sub1.domain

How can I use regex and nginx together so that these will all redirect to the same endpoint? http:// sub1.example.com http:// sub2.sub1.example.com http:// sub3.sub2.sub1.example.com https:// sub1....
1
vote
0answers
44 views

CORS and Preflight problems while making api calls

I have some CORS and preflight problems with my software I can't solve. To test it I was ursing a cors test site to simulate it. When I make an api request to my server application I get the following ...
2
votes
1answer
99 views

.htaccess redirect/rewrite many domains to many domains

My idea is: requests to service.example.com should be redirected to service.example.com, all the other requests to example.com should be redirected to base.example.com My host is configured in such ...
1
vote
1answer
193 views

CORS conflict after enabling FPM in PHP

In the .htaccess file on my web server, I have the following CORS header set: Header set Access-Control-Allow-Origin "example.com" In one of my PHP scripts, that I frequently call while ...
-3
votes
1answer
105 views

How redirect by .htaccess dynamic nested URL

How use write rule? I need to redirect www.example.com/accesories to www.example.com/accesories/item UPDATE: If I use Redirect /accesories /accesories/items I receive: www.example.com//accesories/...
0
votes
0answers
42 views

Prohibited Y0u don't have permission to access this resource

My laravel website gives me an error after changing one piece of code from a comment to code back to a comment again in the .htaccess file. I've tried I think everything with the folder permissions ...
1
vote
1answer
29 views

Apache2 - Define two working Auth Providers

I want to define two different auth providers in my apache2 .htaccess in case one fails (the desired one is ldap but i want to be able to login even if ldap fails via local htpasswd file) I tried this ...
2
votes
1answer
41 views

Apache rewrite proxy only homepage

I've tried various regular expressions (^/$, ^index.php$, ^$) to rewrite/proxy just the homepage of a WordPress website through .htaccess. For the record I have the appropriate modules loaded to ...
1
vote
1answer
247 views

.htaccess multiple 301 redirects

I am moving a blog hosted on an Apache server to a new domain. The permalinks are kept the same for the blog posts but there are a few pages where the url slug will change on the new domain. My ...
1
vote
1answer
53 views

Apache FilesMatch (global config) priority over local .htaccess

I want to protect all Wordpress admin interfaces (wp-login.php/wp-admin) in my server. To do this, I want to create a global config in Apache, asking for a fixed user/password (HTTP basic ...
2
votes
1answer
31 views

Issues with Redirection and HTACCESS

I have two URLs: https://example.com/view?id=1001554 - Old URL https://example.ca/search-item.html?psid=1001554 - New URL As you can see the site changes from .com to .ca and on the new URL there ...
0
votes
1answer
34 views

.htaccess old site redirect to new with each url separate redirect

I have a website that is migrated to another URL. So I wanted to migrate my all previous URL to a new URL with a different segment. For example Main redirect Old site is: https:// myoldsite.abc New ...
1
vote
1answer
77 views

Htacess Helicon APE false positive 403 Fail

Instead of using web.config for my rewrite rules, I have been using Helicon APE for emulating Apache's .htaccess feature. I have a large universal .htaccess file that is applied across the server as ...
3
votes
2answers
140 views

.htaccess in upper directories being ignored

I have a .htaccess file in /var/www/html/htc directory with specific rules to bookmatic.net and another .htaccess file with general rules to all domains in /var/www/html When accesing bookmatic.net, ...
0
votes
1answer
75 views

403 redirect not working .htaccess

I want to block users from India from the website and redirect them to a custom 403 page. Here's the code that i placed in .htaccess file: ErrorDocument 403 /403.html deny from 1.6.0.0/15 deny from 1....
1
vote
1answer
27 views

Does an .htaccess redirect to a different folder activate the second .htaccess within?

On my apache site, I have the following redirect: RewriteCond %{REQUEST_URI} !^/web/ RewriteRule ^(.*)$ /web/$1 which redirects from the root directory, to the "Web" directory. Will this ...
0
votes
0answers
23 views

How Redirect Question Mark with Uppercase?

I tried redirect this url https://example.com/?MD with this RedirectMatch 302 [A-Z] https://example.com/ But failed, ane helps?

1
2 3 4 5
53