Questions tagged [apache]

The Apache HTTP Server is an Open Source Web server, which originated from a series of patches to the NCSA HTTPd. Apache is the world's most popular Web server, which is run on 54.90% of all Web servers according to the Netcraft survey conducted July 2010.

Filter by
Sorted by
Tagged with
0
votes
1answer
28 views

Can I ban IP based on page GET then instant POST? (Spambots)

While there are lots of rules to id and ban spambots, e.g., Fail2Ban rules, it's always a cat-and-mouse chase. Nothing's perfect. Then it hit me. The one thing they always do is get a page, then ...
0
votes
0answers
7 views

Trying to force Apache to use only TLSv1.3 on a vhost, but it refuses to disable TLSv1.2 [migrated]

I have a test vhost on my web server for which I'm trying to enforce TLSv1.3-only but Apache refuses to disable TLSv1.2. TLSv1.3 does work however the following validation services all show that ...
1
vote
1answer
33 views

Safe way to block unwanted bots without potential impact on good ones

Currently, I have blocked several bots in htaccess (apache 2.4) like this. (Have used imaginary bot names in the below example.) SetEnvIfNoCase User-Agent .*abcbot.* bad_bot SetEnvIfNoCase User-Agent ....
1
vote
1answer
36 views

Can I use the .htaccess file or another solution to address www and non-www duplicate content issues?

Ahrefs is returning a series of duplicate content URLs for my own website i've asked them about and which they've said needs to be addressed on the CMS side, and which they cannot help with. The ...
3
votes
1answer
43 views

Redirect URL ending in certain `variable=value` query string, to `URL?variable` (i.e., strip `=value`)

I'm trying to create a 301-rewrite for URLs ending with ?amp=1 to nearly the same URL and query string, just stripping the value (=1). Examples: https://example.com/?amp=1 should redirect to https://...
1
vote
1answer
65 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/...
11
votes
3answers
8k views

When is the leading slash (/) needed in mod_rewrite patterns?

Here is an example from the Apache documentation for enforcing canonical hostnames: RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/?(.*) http://www....
1
vote
1answer
39 views

How can I run commands in my system using a website running on my local server?

I set up an Apache server on my system. I want to run commands and files using the website running on my local system. How do I trigger a file running using browser? What i want to do: I have a file ...
3
votes
1answer
42 views

IIS rewrite rules for SEO friendly URLs don't work in .htaccess for Apache

I'm using a Pi 3 for the Apache server but I can't figure out how to setup .htaccess. Previously I used IIS with which it is easy to implement SEO-friendly URLs. Linux .htaccess is very different and ...
1
vote
2answers
44 views

How to remove all .html extensions from all pages of site running under Apache?

On a shared hosting environment based on CentOS-Bash, Apache (with Nginx as a "reverse proxy"), PHP and MySQL I host a MediaWiki website. Normally, no webpage has a .html extension. I have ...
1
vote
1answer
43 views

How do I make my home web server public when port 80 is forwarded with my CenturyLink router?

I have the latest version of Apache Lounge, and I want to make it accessible to the other people. My Website IP is 192.168.0.61, and in httpd.conf these are the settings I added Listen 192.168.0.61:80 ...
1
vote
0answers
47 views

SEO - Google select a another domain at canonical url

I have a problem with my domain for selected canonical url by google. I have a vps for my website with apache. I created a redirect for website ip, but some domains have my ip in DNS and redirect to ...
3
votes
2answers
336 views

Is it possible to check the case on Apache redirects or aliases?

I have a big website (15,000 pages) with a log list of redirects (about 800) that have been used in marketing pieces for years. My Apache server has been running mod_rewrite for the past 10 years or ...
1
vote
0answers
30 views

What can be a reason of a “The requested URL / was not found on this server” error in case of an addon domain? [closed]

Let's say I have a site hosted on a.example.com. I'm adding an addon domain to the server (shared hosting): b.example.com and point this domain to the server IP address. Visiting b.example.com ...
2
votes
0answers
39 views

Prevent search engines from crawling and indexing all domains and subdomains set up under an Apache server

My company is renting a CentOS server, with one main domain and ~30 subdomains (the number varies, but it's usually around 30) hosted on it. The subdomains themselves are used for various purposes (...
2
votes
0answers
47 views

How to customize/change 3xx status pages in Apache?

How can I customize the 3xx status pages Apache? I am able to customize the 4xx and 5xx error pages using the ErrorDocument directive. I have tried the same for the 3xx status pages, but no good. I am ...
8
votes
3answers
36k views

How to redirect / convert any URL to lowercase?

I am using: <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com [NC] RewriteRule (.*) http://example.com/$1 [L,R=301] </...
3
votes
1answer
2k views

Htaccess, deny any request not coming from a form in the website

I'm not an .htaccess expert, so I beg your pardon for the basic question. In a website I'm working on there's a form. The action URL of the form is a file placed in the root of the website. I want ...
3
votes
1answer
424 views

Can a reverse-proxy be used to show content from a domain with Windows server on another domain with a Linux server?

I have a website that was developed and is hosted on a Windows server (Server A). We want to have these Windows hosted pages to show up on another website that is hosted on a Linux server (Server B). ...
2
votes
1answer
271 views

Redirect from index.html to its directory using .htaccess?

For each page of my website, it is named index.html and stored inside a folder of the name of the page. example.com/ serves example.com/index.html example.com/about/ serves example.com/about/index....
1
vote
1answer
22 views

Subdomain rewrites without using certs that don't support sub domain affecting

I am using LetsEncrypt to generate and renew my certs for my website. Unfortunately, it does not support subdomains. Having said that, I have a ton of rewrite rules that work fine. For example: ...
7
votes
2answers
780 views

Is Checking For mod_write Really Necessary?

Recently I noticed that many people post .htaccess files here with: <IfModule mod_rewrite.c> Sometimes this even appears several times in the file! It obviously checks to see if mod_write is ...
4
votes
1answer
1k views

Redirect all index.html pages to subdirectory?

I have an old site ported from WordPress to basic HTML (don't ask why) and every page is ending in the subdirectory/index.html. This is causing some funky indexing issues, so I wanted to 301 all the ...
1
vote
1answer
46 views

Flush cached selector in Adobe Experience Manager without flushing entire directory

How can I use selector based cache flushing in Adobe Experience Manager? http://example.com/content/myapp/us/en.child1.xml http://example.com/content/myapp/us/en.child2.xml Lets say,we have xml's ...
1
vote
1answer
53 views

Htaccess - replacing a query string with a numeric value

I don't know why but this htaccess item doesn't work for me. I have something like this after update user profile public/user_profile/show_user.html?id=4 and I want to have public/user_profile/...
0
votes
0answers
12 views

Pages viewable stacked on top of one another? [duplicate]

I've asked this before but couldn't find my old account. I'm trying to figure out why my webpages are being stacked on top of one another in my control panel. I think it's a scraper doing the return ...
2
votes
1answer
51 views

How can I rewrite all Files to the Index Folder and also Remove the Extensions

I've been looking for a solution for a few hours now, and I'm struggling to understand why the Regex doesn't act like Regex... If you just try to match a letter, it doesn't match a letter, and I can't ...
5
votes
2answers
9k views

Remove query string from 301 redirect URL

I'm having some trouble with redirects and I haven't been able to get this to work. I want to make the following http://www.example.com/seasonal/christmas?p=15 redirect to http://www.example.com/...
1
vote
1answer
99 views

Creating web hosting in a laptop

I was searching Google for how I can configure my webdoamin registered with GoDaddy and static IP I have obtained from Mumbai ISP. I have seen one question which was asked three years before in which ...
2
votes
1answer
32 views

Apache doesn't redirect subfolders

I'm having trouble configuring my Apache server through the .htaccess file. I want to redirect all request from my domain (example.com, www.example.com, example.com/folder1/folder2) to my new domain (...
1
vote
1answer
71 views

PHP Undefined index: REDIRECT_STATUS - error 404

Custom 404 page in PHP using .htaccess file. If page dosen't exist redirect to error.php. I don't know why but it doesn't work. Notice: Undefined index: REDIRECT_STATUS on line 2 <?php $error = $...
1
vote
1answer
72 views

Htaccess RewriteCond based on environment variable

I find apache very unfriendly. Anyway. I have this: RewriteRule (.*) - [QSA,E=DOMAIN_NAME:localhost.com] This doesn't redirect, which is fine: RewriteCond "www.%{ENV:DOMAIN_NAME}" "!=...
1
vote
1answer
20 views

What's the difference between access and access plus in ExpiresByType directive?

I have seen: ExpiresByType image/jpg "access 1 year" But also: ExpiresByType image/jpg "access plus 1 year" So, what's the difference between those two lines ?
1
vote
1answer
16 views

What types of files does ExpiresDefault include?

I have: ExpiresActive On ExpiresByType image/jpg "access 1 years" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType image/gif ...
3
votes
2answers
563 views

HSTS implementation when using www.TLD

Been looking at implementing HSTS in to one of our sites, hoping to validate it on the preload list. But I can't get my head around how it works with the www. Subdomain. Our site forces secure www....
7
votes
2answers
455 views

In .htaccess files, is there any difference at all between “!=on” and “off”

I’m trying to better understand Apache’s use of a binary attribute. In an .htaccess file with the code # Check if HTTPS is 𝗻𝗼𝘁 𝗼𝗻 RewriteCond %{HTTPS} !=on Is there more processing occurring&#...
5
votes
3answers
6k views

Is there an alternative to .htaccess?

Is there an alternative to .htaccess, in case the webhoster disabled the use of .htaccess files? I can set some PHP variables and headers inside the PHP files but how can I perform actions like ...
11
votes
3answers
25k views

How can I use robots.txt to disallow subdomain only?

My code base is shared between several environments (live, staging, dev) & sub-domains (staging.example, dev.example, etc.) and only two should be allowed to be crawled (ie. www.example and ...
4
votes
1answer
40 views

Mod Rewrite Multiple Query String

I'm having trouble using modrewrite to redirect a URL with multiple strings. I have a PDF handling script. I want to redirect something like: https://www.example.com/pdfs/samplepdf.pdf/open [or /...
1
vote
3answers
5k views

Why isn't my PHP file running and instead Apache is offering it for download?

I recently installed Apache and later installed PHP too. When I browse to http://localhost/index.html it displays the default Apache page "it works". But when i try to run http://localhost/phpinfo....
9
votes
1answer
13k views

.htaccess rewrite URL leads to missing CSS

I am trying to make my url from this: example.com/view.php?id=15 To this: example.com/watch/15 My code in .htaccess is as follows: Options -Indexes Options +FollowSymlinks RewriteEngine On ...
2
votes
2answers
47 views

Excluding homepage from Rewrite rules in htaccess

I would like to have this new prerendering service I'm using NOT apply its magic to the homepage and basically only to pages that begin with https://thechartcast.com/episodes/. Below is the relevant ...
5
votes
5answers
25k views

“File does not exist” in apache error log

This is an example of an error in out log file: File does not exist: /var/www/website/female, referer: http://www.example.com/female/dresses/A-Dress-Black /female does not physically exist, because ...
5
votes
3answers
4k views

How to write a generic .htaccess file rule, regarding RewriteBase

The following rule in my .htaccess works just fine for routing calls to index.php: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L] However, this does not ...
1
vote
1answer
56 views

Apache not accessible from outside local network

I can only connect to my Apache server using devices on the local network and not from the outside. I think that this is a port forwarding issue, as I'm getting a Connection Timed Out for the port ...
2
votes
0answers
53 views

How can I keep WordPress files in sync on two servers behind a load balancer?

I have two Amazon Linux web servers with an Amazon Load Balancer, and I want to use WordPress to display content at the document root level only. The site has other subdirectories with PHP files that ...
2
votes
2answers
946 views

How can I display the MD5 or SHA1 of files in a web server directory?

When you don't have an index.html, most web servers will show a list of files in the directory. Can I get preferably lighttpd (but Apache as a backup) to do show a file's MD5/SHA1 (along with standard ...
1
vote
2answers
236 views

Moving RewriteBase rule in htaccess to httpd.conf

I'm now working in a server environment where I can access and edit httpd.conf, which is preferable from a performance and a revision control standpoint. I have a few sites (they are Drupal) running ...
1
vote
1answer
47 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
24 views

Invalid command 'SSLEngine', with “--enable-ssl” configured Apache

I built an Apache 2.2.32 server on Ubuntu from sources, and if I test my phpinfo() I see: './configure' '--prefix=/usr/local/php_7.2.25' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysqli=/usr/...

1
2 3 4 5
23