Jump to content

HTML/CSS help ! (and other codes for web..)

so I want to create my own 404 page, so that whenever somebody types in the wrong sub-adress to my main domain, it not only showes them a web page regardless, but also a bit of text in witch it sais : page (insert whatever the guy typed here) not found.

but I want it to detect what the person typed in their browser's search bar. so that its done by itself and I don't have to make an infinite ammount of pages.

is this possible ?

 

how can I make it so that it alwais gets to this page if some random sub-adress is typed ?

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to comment
https://linustechtips.com/topic/608893-htmlcss-help-and-other-codes-for-web/
Share on other sites

Link to post
Share on other sites

1 minute ago, thekeemo said:

is the GET tage what you are looking for?

I do not know about said tag >.>

so probably...  i ill google it up :) thanks !

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to post
Share on other sites

14 minutes ago, givingtnt said:

I do not know about said tag >.>

so probably...  i ill google it up :) thanks !

http://php.net/manual/en/reserved.variables.get.php

Thats that. If you need to get in touch chances are you can find someone that knows me that can get in touch.

Link to post
Share on other sites

If you're hosting on your own server, I don't think its possible as lighttpd and some other webserver software only allows plain .html (no php etc) files to be used for error pages.

Speedtests

WiFi - 7ms, 22Mb down, 10Mb up

Ethernet - 6ms, 47.5Mb down, 9.7Mb up

 

Rigs

Spoiler

 Type            Desktop

 OS              Windows 10 Pro

 CPU             i5-4430S

 RAM             8GB CORSAIR XMS3 (2x4gb)

 Cooler          LC Power LC-CC-97 65W

 Motherboard     ASUS H81M-PLUS

 GPU             GeForce GTX 1060

 Storage         120GB Sandisk SSD (boot), 750GB Seagate 2.5" (storage), 500GB Seagate 2.5" SSHD (cache)

 

Spoiler

Type            Server

OS              Ubuntu 14.04 LTS

CPU             Core 2 Duo E6320

RAM             2GB Non-ECC

Motherboard     ASUS P5VD2-MX SE

Storage         RAID 1: 250GB WD Blue and Seagate Barracuda

Uses            Webserver, NAS, Mediaserver, Database Server

 

Quotes of Fame

On 8/27/2015 at 10:09 AM, Drixen said:

Linus is light years ahead a lot of other YouTubers, he isn't just an average YouTuber.. he's legitimately, legit.

On 10/11/2015 at 11:36 AM, Geralt said:

When something is worth doing, it's worth overdoing.

On 6/22/2016 at 10:05 AM, trag1c said:

It's completely blown out of proportion. Also if you're the least bit worried about data gathering then you should go live in a cave a 1000Km from the nearest establishment simply because every device and every entity gathers information these days. In the current era privacy is just fallacy and nothing more.

 

Link to post
Share on other sites

17 minutes ago, burnttoastnice said:

If you're hosting on your own server, I don't think its possible as lighttpd and some other webserver software only allows plain .html (no php etc) files to be used for error pages.

nah im using a hosting service (hostinger.co.uk) wich provides php support. so im fine for that.

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to post
Share on other sites

25 minutes ago, thekeemo said:

thanks !

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to post
Share on other sites

in the root of your sites directory create a file called .htaccess if it doesn't exist and add the line

<code>

ErrorDocument 404 http://your-domain.com/your-error-page

</code>

Then if a request comes in and the server cant find the resource, it will serve your error page.

Link to post
Share on other sites

27 minutes ago, WaxyMaxy said:

in the root of your sites directory create a file called .htaccess if it doesn't exist and add the line

<code>

ErrorDocument 404 http://your-domain.com/your-error-page

</code>

Then if a request comes in and the server cant find the resource, it will serve your error page.

thank you !

 

do I need support for some technologies ? (say php..) for this ?

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to post
Share on other sites

1 hour ago, givingtnt said:

thank you !

 

do I need support for some technologies ? (say php..) for this ?

Nope, not for htaccess. But for getting the page you will need PHP or some overly fancy javascript. Off the top of my head, on the error page have something like 

<?php

echo $_SERVER['HTTP_REFERER'];

?>

 

in the body of the page. 

I am good at computer

Spoiler

Motherboard: Gigabyte G1 sniper 3 | CPU: Intel 3770k @5.1Ghz | RAM: 32Gb G.Skill Ripjaws X @1600Mhz | Graphics card: EVGA 980 Ti SC | HDD: Seagate barracuda 3298534883327.74B + Samsung OEM 5400rpm drive + Seatgate barracude 2TB | PSU: Cougar CMX 1200w | CPU cooler: Custom loop

Link to post
Share on other sites

<?php
echo htmlentities(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST));
?>

But not sure if the Sub domain also is in there

 

else

<?php
echo htmlentities($_SERVER['HTTP_REFERER']);
?>

 

Htmlentites make's a decent defense against people that want to inject malicious code while accessing your website, by changing the header.

You could probably do more, but this is a start.

Quote or mention me if not feel ignored 

Link to post
Share on other sites

7 hours ago, Hazy125 said:

Nope, not for htaccess. But for getting the page you will need PHP or some overly fancy javascript. Off the top of my head, on the error page have something like 

<?php

echo $_SERVER['HTTP_REFERER'];

?>

 

in the body of the page. 

so my page would be : 

 

<html>
	<body>
	<p>
      error404whatever page : 
      	<?php
		echo $_SERVER['HTTP_REFERER'];
		?>
	  not found
	</p>
    </body>
 </html>

?

and it should display the text, then whatever adress is typed, then not found ?

~New~  BoomBerryPi project !  ~New~


new build log : http://linustechtips.com/main/topic/533392-build-log-the-scrap-simulator-x/?p=7078757 (5 screen flight sim for 620$ CAD)LTT Web Challenge is back ! go here  :  http://linustechtips.com/main/topic/448184-ltt-web-challenge-3-v21/#entry601004

Link to post
Share on other sites

YOU DON'T NEED PHP!

I did something similar once, in JS. For the whole link, there is the constant 'location'. If you want it without the protocol (http, ftp, file etc.) and the domain (www.linustechtips.com for example), just the '/main/topic/...' part then you have 'location.pathname'. There are few more of those in JS, but that should be all you need.

 

Edit: 'location' returns 'location.href' by default, but it might be good to made it specific by adding the '.href' part.

Link to post
Share on other sites

14 hours ago, givingtnt said:

nah im using a hosting service (hostinger.co.uk) wich provides php support. so im fine for that.

hostinger allows for custom pages. if you login in and go thre "website" section there is an option called "error pages" this allows you to edit the pages as you see fit.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×