can this be done on a server with htaccess

Discussion Of All Legal Topics Is Fine Anything Goes. Be Respectful of Others. No Personal Information or Attacks.
All Traffic, Link, Banner, Push Notification and Advertising, Offers & Requests Here,.
Domains & Websites For Sale and Requests Here.
Keep One thread per person & No More Than 1 Weekly Bump.
Post Reply
Abby
Verified Member
Verified Member
Posts: 674
Joined: July 13th, 2018, 10:04 pm
Title: No man pays my bills

can this be done on a server with htaccess

#1

Post by Abby » November 20th, 2022, 3:30 pm

Have one htaccess file redirect all 404 pages to a url instead of adding an htacces file to each domain hosted on the server, and what would the htaccess file look like please.




User avatar
TheButcher
Administrator
Administrator
Posts: 17533
Joined: February 2nd, 2018, 11:48 am
Title: I like weekends
Referrals: 1
Contact:

#2

Post by TheButcher » November 21st, 2022, 9:40 am

I know whatever you do with htaccess you can not get 404 pages on phpbb to go to another url other than the root of the domain, I prefer using individual htaccess files per site because some scripts require certain lines of code.

Abby
Verified Member
Verified Member
Posts: 674
Joined: July 13th, 2018, 10:04 pm
Title: No man pays my bills

#3

Post by Abby » November 26th, 2022, 12:56 pm

hello




User avatar
HeidiHoe
Verified Member
Verified Member
Posts: 1653
Joined: February 3rd, 2018, 12:20 pm
Title: Resident Genius

#4

Post by HeidiHoe » November 26th, 2022, 2:36 pm

Can .htaccess reside above domain level? That's what you'd have to do to control all domains with one file. You might be able to modify your server settings to do this. If you're running CMS, for example wordpress, you would want to make sure you're not creating any conflicts by doing this. Why would you want to do this anyway? It's one lousy line of code in one file per domain. Why give up the flexibility and cause potential issues?
The Fourth Turning Is Here

User avatar
HeidiHoe
Verified Member
Verified Member
Posts: 1653
Joined: February 3rd, 2018, 12:20 pm
Title: Resident Genius

#5

Post by HeidiHoe » November 26th, 2022, 2:52 pm

Not something that I'd recommend but i guess you could just add a meta refresh tag to your 404 page.

Code: Select all

<meta http-equiv="refresh" content="0;URL='https://domain.com/page'" />
The code goes in the head but will work when placed anywhere.
The Fourth Turning Is Here

Abby
Verified Member
Verified Member
Posts: 674
Joined: July 13th, 2018, 10:04 pm
Title: No man pays my bills

#6

Post by Abby » November 26th, 2022, 3:29 pm

Thanks heidihoe I'll try it now




User avatar
gspotman
Verified Member
Verified Member
Posts: 1417
Joined: June 6th, 2018, 7:42 pm

#7

Post by gspotman » November 28th, 2022, 7:11 am

My hosting control panel adds a htacess file when I add a new domain to my server.
Teams: 60c094411cbb39b8
Email: gspotman@gmx.com

User avatar
HeidiHoe
Verified Member
Verified Member
Posts: 1653
Joined: February 3rd, 2018, 12:20 pm
Title: Resident Genius

#8

Post by HeidiHoe » November 28th, 2022, 9:46 am

gspotman wrote: ↑
November 28th, 2022, 7:11 am
My hosting control panel adds a htacess file when I add a new domain to my server.
Within the domain folder, not above it. It controls one particular domain, not all of the domains on the server. Anytime you add domain specific settings in your control panel, such as redirect www for example, a .htaccess file is created containing the directive.

Also, if you manually edit the file removing the code or delete the file altogether, you'll see that the settings in your control panel has changed.
The Fourth Turning Is Here

User avatar
tacnet
Board Sponsor
Board Sponsor
Posts: 3641
Joined: February 22nd, 2019, 7:21 pm
Referrals: 9
Contact:

#9

Post by tacnet » November 28th, 2022, 1:01 pm

You can do this in the http.conf file but htaccess files are specific to the domain

Just put this in your htaccess

ErrorDocument 404 https://www.domain.com/404page.html

User avatar
gspotman
Verified Member
Verified Member
Posts: 1417
Joined: June 6th, 2018, 7:42 pm

#10

Post by gspotman » November 29th, 2022, 8:46 am

HeidiHoe wrote: ↑
November 28th, 2022, 9:46 am
gspotman wrote: ↑
November 28th, 2022, 7:11 am
My hosting control panel adds a htacess file when I add a new domain to my server.
Within the domain folder, not above it. It controls one particular domain, not all of the domains on the server. Anytime you add domain specific settings in your control panel, such as redirect www for example, a .htaccess file is created containing the directive.

Also, if you manually edit the file removing the code or delete the file altogether, you'll see that the settings in your control panel has changed.
I mean per domain not all sites hosted on the same server
Teams: 60c094411cbb39b8
Email: gspotman@gmx.com

User avatar
HeidiHoe
Verified Member
Verified Member
Posts: 1653
Joined: February 3rd, 2018, 12:20 pm
Title: Resident Genius

#11

Post by HeidiHoe » November 29th, 2022, 10:45 am

gspotman wrote: ↑
November 29th, 2022, 8:46 am
HeidiHoe wrote: ↑
November 28th, 2022, 9:46 am
gspotman wrote: ↑
November 28th, 2022, 7:11 am
My hosting control panel adds a htacess file when I add a new domain to my server.
Within the domain folder, not above it. It controls one particular domain, not all of the domains on the server. Anytime you add domain specific settings in your control panel, such as redirect www for example, a .htaccess file is created containing the directive.

Also, if you manually edit the file removing the code or delete the file altogether, you'll see that the settings in your control panel has changed.
I mean per domain not all sites hosted on the same server
Yep. OP wants to set 404 for all domains with one .htaccess file instead of changing server settings. Tacnet replied with the specific file on the server that needs to be modified to accomplish what the OP wants to do. Not a good idea, but whatever :roll:
The Fourth Turning Is Here

Hosting Fred
Verified Member
Verified Member
Posts: 320
Joined: October 12th, 2021, 8:43 am
Title: Hosting is my game

#12

Post by Hosting Fred » November 30th, 2022, 10:48 am

If you are running the same scripts on the server itwould be okay but if not then do it the usual way , add a .htaccess file per site,my 2 cents.




XpressPete
Verified Member
Verified Member
Posts: 768
Joined: April 20th, 2018, 7:39 am

#13

Post by XpressPete » December 1st, 2022, 9:02 am

Abby wrote: ↑
November 20th, 2022, 3:30 pm
Have one htaccess file redirect all 404 pages to a url instead of adding an htacces file to each domain hosted on the server, and what would the htaccess file look like please.
why would you want to do it that way?




User avatar
AlexO
Verified Member
Verified Member
Posts: 6409
Joined: February 10th, 2018, 5:37 pm
Title: I like Celebrities

#14

Post by AlexO » December 2nd, 2022, 7:18 pm

This has me thinking can you put a wild card htaccess on the server in the public_html level instead?
Give me celebrity porn :twisted:

User avatar
HeidiHoe
Verified Member
Verified Member
Posts: 1653
Joined: February 3rd, 2018, 12:20 pm
Title: Resident Genius

#15

Post by HeidiHoe » December 2nd, 2022, 9:16 pm

AlexO wrote: ↑
December 2nd, 2022, 7:18 pm
This has me thinking can you put a wild card htaccess on the server in the public_html level instead?
.htaccess needs to reside in the domain root of the domain it applies to. When your site loads for a visitor, it will look for .htaccess within the publicly accessible files for the website. That's the domain root folder, not above.

You can store files above that level and link them for download thus preventing direct web access but I don't think you can rig anything similar for .htaccess. Not as far as I know anyways.

If you place .htaccess within a directory folder inside the domain root, it will control anything located within that directory.
The Fourth Turning Is Here

can this be done on a server with htaccess

Post Reply