How to add url to index.html - html

I am a total newbiew so please forgive me if this looks like a stupid question.
I have a simple HTML page that I want to show with a custom URL.
Currently I have only one site www.mysite.com and that URL is showing on Google and in the addressbar of my browser. But how can I make that when someone goes to my site that it looks like www.mysite.com/my-keyword
So basically what I want to do is to show my site with a fixed URL that have the keyword in it: www.mysite.com/my-keyword
Do I need to make a extra page? My initial thought was to make one Index.html with a http-redirect to my second page, so Index.html + my-keyword.html or is there a simpler way?
I want to achieve this because for Google search results.
Edit: I am using HTML only. But I could use PHP or JavaScript too if someone has a solution for that.

You should read a little bit about URL's. The thing you call a "keyword" is refered to as "path".
It's possible to use a meta tag in the <head>section and redirect the user to another location like this:
<META http-equiv="refresh" content="0;URL=http://www.example.com/page2">
You could also change the value of the adress bar with JavaScript, but that's probably not what you want.
You might want to restate your question with more details about what it is you are trying to do.

Related

From Newsletter thank you form - what HTML code can I add to make sure the <a href="http://mywebsite.com"> refreshes?

I have just created a Newsletter Form on my website, via an external provider called "Benchmark" - to save time because I am not a professional programmer, so I only know HTML and CSS coding so far.
Their service generates an automatic thank you page that I am free to use, but when you click "back to the website", it automatically goes back to the cached page, which means that all the data inserted into the Newsletter form (email and name) is still there.
I think this gives the customers a lot of uncertainty about whether their data has gone through (and Benchmark replied that I had to make my own "Thank You" page if I want this function), so I would like to create my own page with a link (using HTML-code), which will automatically refresh the page that is linked back to - so that the customer comes back to the page with an empty Newsletter Form.
I have seen some similar questions with answers in the Forum, but as far as I could see, they use other programming languages that I don't know how to implement, so if anybody knows of a method of how to do this with HTML (and CSS, if needed), I would be very grateful. Thank you in advance!
If I understand correctly, you want a page that will redirect to your newsletter form (with the fields empty). You have a couple of options: use a bit of javascript, or use an HTML meta tag. For both of these you'll need a new page. Since you want a pure HTML answer, I'll show you the meta tag version first.
For the meta tag, you'll simply want to put the following code in the head section of your page:
<meta http-equiv="refresh" content="0; url=http://example.com/" />
The javascript solution would also go in the head section as a <script> tag:
<script type="text/javascript">window.location.href = "http://example.com/";</script>
In either one, just replace http://example.com/ with the address of your newsletter form and you should be good to go.
There's also this question that you can look at if you want to learn more.

How can i redirect to anthoer website when i use base tag?

I am using base tag to keep CSS and JAVASCRIPT when any one doing trailing slash, or write any thing after last slash in url ?
for example my website like this:
http://www.example.com
because i am using base tag so when i redirect any thing its be like this:
http://www.example.com/anything
when i redirect to another website like facebook
so its be like this
http://www.example.com/https://www.facebook.com
i want be like this:
https://www.facebook.com
this is my base tag
<base href="http://www.example.com/">
how can i do this ?
any help i will be gratefull
i found the solution of my question and i want share it with you because you deserve it, it's so simple just put two slash before the URL.
like this:
facebook
and it works perfectly
thank for every one see my question.

HTML remove url variables, NO PHP or JS solution

My site uses both PHP and the JS AJAX so I'm fairly familiar with them both, and I don't want a solution that includes them. I have this page structure where all my users stay on just one landing php page, which then fetches the right content depending on the URL's p variable.
http://www.example.com/?p=about
http://www.example.com/?p=aMap-anothermap-evenAnothermap-lastelyTheFile
This page structure works great for me except that I don't know the right way to make a link that just removes the whole ?p=home. Because I want my home/start page to be variable free. I want it to be
http://www.example.com/
rather than
http://www.example.com/?p=home
Now I could just make the link
http://www.example.com/?
And then just remove the ? with the JS pushState(), but that would look pretty silly and would only work for JS users.
Let's say i would want to the do the above example with just the ? then I could create a link like this.
Link
<script src="SomeCoolPushStateScript"></script>
And I know from experience that this doesn't even work:
Link
So here comes the question: How do I remove the ?variable=something part of an URL when using an HTML href?
The path ./ should do the trick.
Link
If you want to preserve the main script name, like index.php, you will have to include that name.
Link
Alternately, you could dynamically generate domain-relative or absolute URL's with PHP.
You don't need to use querystrings.
Link
would go to example.com's root.
I don't recommend using "./". This would do what you want if the user is on a page that is in the root directory of your website (e.g. http://www.example.com/page.html). However, this would not work if they were on a page in a subdirectory. E.g. if the user's on http://www.example.com/hello/page.html, it would just link to http://www.example.com/hello/.
Using "/" makes sure the user goes to the root of your website.

Link to current page html

Have been searching some topics but don't think I have found the exact answer I was looking for hence I try here. In my Wordpress website I have a hardcoded button on around 150 pages on each top of a page. I would like to link to an angor text /#anchor halfway of each of this pages.
Now I don't want to enter every specific URL manually. Is there a HTML trick where you refer to the current URL, something in the order of: .com/currentpage/#anchor?
Thanks in advance for any help or tips.
You can add a link on current page without add a page url.
For hash
Link
For QueryString
Link

Linking to iframe pages

Is possible to link on sub page that is in iFrame?
So basically:
On www.domain.com/page I have just normal HTML page. And on that page I have iFrame where I get the content from www.anotherdomain.com.
Now on anotherdomain.com I have several subpages likes this:
www.anotherdomain.com/spage1
www.anotherdomain.com/spage2
etc.
Now the question is that is it possible to somehow link to one of these frames so that when user uses this link, it would go on one of these subpages. For example like this:
www.domain.com/page#spage2
so that then the www.domain.com/page would show on iframe the content from the page www.anotherdomain.com/spage1
If I have understood correctly, this is not possible but I just need some confirmation on this :)
Sorry for bad explanation. Ask more info if you didn't understand what Im trying to explain.
If I understand what you are asking for correctly:
When a visitor goes to domain.com/page#spage2 you want them to see a url of: www.domain.com/page with the content of anotherdomain.com/spage2
If this is correct, I don't think you can do this with just HTML. You would need either regex in a .htaccess file or with PHP taking advantage of the $_SERVER["PHP_SELF"] call.