Multiple URLs for one page - docusaurus

Is there a way to have more than one URL for a page?
I have:
---
slug: /foo
---
I want the page to load with /foo or /bar.
I suppose I could make another file with the other slug and have it mimic content... but hoping there is another way.

Related

URL Rewrite gets rewritten with Vue Router

I have 2 domains that is mapped to a single NuxtJS STatic Generated app. domain1.com should be just normal. But I want domain2.com to only show domain1.com/chat/ page on its every single URL may it be homepage or /h/ and /n/.
I already put a URL Rewrite on the desired folder location like /chat/. When I vist domain2.com the URL rewrite takes effect and renders the /chat/index.html, but immediately after the rewrite takes effect the router will also take effect then brings me to the homepage.
Is there a way to solve this? I am using IIS URL Rewrite in a Microsoft 2012 server by the way

Intrasite links breaking with S3 redirect

I've got a static website setup with S3 and CloudFront. When I navigate to a subfolder like example.com/nonexistant/, my example.com/index.html page loads (as I want it to), however it's text only and all of my intrasite links get messed up.
For example, my logo is located at example.com/img/logo.png. When I navigate to example.com/nonexistant/, the html for example.com/index.html loads, however it now looks for my logo at example.com/nonexistant/img/logo.png.
So links like <img src="img/logo.png"> are breaking because it is starting the search for the file from the wrong directory.
Is there a solution where I can fix something in my Redirection rules to have all pages ending in / redirect to example.com? I know I could probably just go edit my code to have all paths just appear as <img src="https://www.example.com/img/logo.png">, but I'm wondering if there is an easier fix here.
EDIT: I've already set up in CloudFront to have 404s go to /index.html with status code 200, and have in S3 set up my error document as index.html
Change your links to absolute paths, without the hostname.
<img src="/img/logo.png">
S3 redirect rules can only match the key prefix -- the left-anchored part of the string, so they can't be used to address this.
You could also use a Lambda#Edge function in an origin response trigger, if you really wanted to redirect 404 responses for paths ending in / back to the main page, but a redirect rewrites the path in the address bar (by definition -- otherwise, it is not a "redirect"), and I assume since you are doing the 404-to-200 transformation then you are probably doing something like an SPA where you need the path to remain the same, despite index.html being displayed.

Multiple Domains to Display Content from Landing Pages on Another Domain

We have created a bunch of landing pages on a Joomla CMS system, such that the URL for each landing page is www.domain.com/page1.html and www.domain.com/page2.html, and so on. Of course the page1.html isn't really an HTML file it is a dynamic CMS page, just rewritten with htaccess.
The goal is to have one of our other domains, something like www.uniquedomain1.com show the content of www.domain.com/page1.html. Or, another domain like www.uniquedomain2.html show the content of www.domain.com/page2.html.
This needs to be search engine friendly so we can't use URL masking. Also we can't use HTACCESS redirects as this actually changes the URL in the browser bar. Need to keep the www.uniquedomain1.com URL in the browser bar.
Tried Apache VirtualHost options without any luck. You can park in a directory but not from a URL.
Ended up parking the domains on one folder, and then creating a PHP script to detect the domain host and then use CURL to query the correct url and deliver content. This whole thing seems ridiculously over complicated, and of course CURL isn't the best option, but it is all we could get to work.
Any thoughts on how to do this, or a better solution?
You can use HTACCESS redirect rules to do it without performing a redirect.
Change the html file names to be the domain name of the desired domain like domain.tld and do something like this in an .htaccess file
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(?:www\.)?([a-z0-9\.-]+\.[a-z]+) [NC]
RewriteRule ^$ /%1.html [L]
A quick test of this worked for two of my test (sub)domains test.domain.tld and test2.domain.tld. Both properly redirected to files with the names test.domain.tld.html and test2.domain.tld.html without modifying the URL.
You could also just use your PHP wrapper script to grab the content of each of the miscellaneous html files and output them.
If you renamed all of your HTML files (as in my previous suggested answer) to be domain.tld.html you could do it fairly easily. Something might look like:
<?php
require($_SERVER['SERVER_NAME'] .'.html');

HTTP: Semantics of breaking webpage information into two pages

I have a webpage whose information had to be split into two separate pages. I want visitors to inform of the fact that there are now two different pages, and thus serve visitors of the old single-page page a custom error page like
(Depending on who you are, ) the page you want is either of these:
*Link to page A*
*Link to page B*
This should be in HTML (to obey the general web site style).
The things that I'm unclear about are semantics and apache configuration
What HTTP Status Code to serve? There is 301 Moved Permanently, but I have more than one alternative to offer.
Is it possible to configure apache to my needs without a hacky LocationMatch or similar? Ideally, I would like to use the normal file serving semantics with the exception that the HTTP Status code should not be 200.
Thanks for the clarifying comment.
In answer to your two questions, I'd say:
Yes, 301 is the correct response to give. This will say that the old page was moved permanently, and will redirect the user to the interstitial page with the links.
You can accomplish this by adding a line to the .htaccess file in the directory that the old single page was once in (assuming you keep the new page there too). Or you can add a line to your main httpd.conf file. The lines would look like this:
.htaccess
Redirect 301 ./old_page.html ./new_interstitial_page.html
httpd.conf
Redirect 301 /path/to/old_page.html /path/to/new_interstitial_page.html
EDIT : Without any more context, this really does sound like a redirect scenario. In HTTP terms, the "resource" that was once available at the old location is now available (albeit in parts) at a new location, so you would "redirect" the client to the new location or to the interstitial page.
But if that doesn't seem right to you, you can try a "410 Gone". This says that the resource no longer exists at all, and instead directs the client to an error page. You can then customize the error page to contain links to Page A and Page B. Your .htaccess would look something like this:
# Enable URL matching and match the old page with "Gone" (G), "Last rule" (L)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^oldPage.html$ - [G,L]
</IfModule>
# Special 410 page with links to Page A and Page B
ErrorDocument 410 /path/to/custom/410-page.html

Use .htaccess To Redirect Page Without Changing URL With 'mod_rewrite'

I have a script on my page that checks the url for the word signing. If the word exists, it shows the signin form in a dropdown on page load. I'd like to avoid creating extra files on the server, so I was wondering how I could do this:
When the user is at either of these urls:
http://abramobile.com/signin
http://abramobile.com/sign-in
Then direct the page back to the homepage, but leave 'signin' or 'sign-in' in the URL so that the script on my page detects that it's in the URL.
What would the mod_rewrite be to put in my .htaccess file? Thanks!
This should do it. This matches against the URI being exactly /signin or /sign-in and internally rewrite the URI to / so that that gets served.
RewriteRule ^sign-?in$ / [L]