How to redirect to the page on another domain with 'a' tag in Vue js project? - vue.js

I have an ordinary link to another page in my HTML:
<a href='facebook.com'>
or
<a href='www.facebook.com'>
When I click on it, its redirects me to:
my-domen.dev/facebook.com
How to redirect correctly to page on another domain?

You need to specify the protocol if you are attempting to trying to load an external URL.
<p>Right click and open links in a new tab.</p>
Internal - Will throw 404 - facebook.com<br>
Internal - Will throw 404 - www.facebook.com<br>
External - https://facebook.com<br>
You can read more about it here: Why does an anchor tag's href values need http:// preprended to the URL?

Related

VueJS real SEO friendly 404 page for search engines like Google / MSN

I am not VueJS programmer, but I work with in a company where we developing a VueJS website.
The website have articles. The URL is something like this:
http://example.com/here_is_news_from_sofia.htm
However if you type:
http://example.com/here_is_news_from_blabla.htm
You should go to 404 page.
I inspected several websites and stackoverflow questions, they explain how you should do catch-all router etc, so finally you get a page with "404 Not Found" text on it.
However, in ALL cases, the HTTP code send to the client is not 404, but 200.
With my team, I elaborated this:
When you go to any article, you get something like this:
<html>
<body>
<div id="app">
<app />
</div>
<script src="/js/client.js"></script>
</body>
</html>
Of course, if you click on a link, this page remains and everything is loaded via JS dynamically.
Then lets suppose article is not found.
VueJS will be able to show "404 Not Found" as text, but because HTTP headers are already send (HTML page is already loaded), it will not be able to send 404 code to the client.
For the same reason, VueJS can not send 301 code redirect to the client.
VueJS can incorrectly change the URL in the browser to "http://example.com/404.htm" - this is NOT a correct solution for search engines, since this is purely client-side (in-browser) "trick".
The other think it can do is to execute fancy redirect, as shown here Vue-router redirect on page not found (404) :
Vue.component("page-not-found", {
template: "",
created: function() {
// Redirect outside the app using plain old javascript
window.location.href = "/404.htm";
}
}
This will make the browser to reload the /404.htm page from the server and if the server (Apache / Nginx) is configured correctly, it will send "correct" 404 code to the client.
However I don't think Google and MSN will recognize that http://example.com/here_is_news_from_blabla.htm is a 404 page.
Am I missing anything?
Is there another way VueJS might handle this situation?
How VueJS websites gets indexed from search engines like Google and MSN?
Off topic bonus question - can VueJS generate visible HTML code that contains the article?
If that's a single page application, you can set up dynamic route matching with parameters with vue-router. And dynamically update your meta tags with javascript. I am using quasar vue framework, which handles all of this SEO feature.
I added slug data to the article saved in the database and use it as a route parameter.
https://quasar.dev/vue-composables/use-meta
https://router.vuejs.org/guide/essentials/dynamic-matching.html
You can use quasar vue framework, develop vue app in SSR mode and deploy it to the server.
https://quasar.dev/quasar-cli-vite/developing-ssr/handling-404-and-500-errors

How to get the last url in a chain of redirects in vueJS

I'm trying to follow through on a url that redirects me to another page using VueJS.
Combing through the docs I could not find anything that allows me to retrieve the last url after the redirect.
You can try document.referrer, it returns the URI of the page that linked to the current page.
If you're using VueRouter, you can also check https://router.vuejs.org/guide/advanced/navigation-guards.html#global-before-guards

Laravel authentication routing after click login button

I have 2 Laravel application inside var/www/html directory.
In the address bar, if we type localhost/first the Laravel authentication will be displayed and the URL is http://localhost/first/public/auth/login but after i click submit button the URL become http://localhost/auth/login and it shows a error:
The requested URL /auth/login was not found on this server.
can you suggest me what is wrong?
In the form you have the post url as /auth/login
Just keep post url as blank or give complete path in the form open tag /first/public/auth/login.
If / is there it will take the path from the root rather than going relative to the app root.
Can give correct update if you can post your login form's blade template also with the question

Firefox: "Some parts of this page are not secure, such as images." What counts as insecure?

I use the browser Firefox, and sometimes, on certain webpages, the SSL icon says "Some parts of this page are not secure, such as images." What, exactly, counts as an insecure element?
Thanks!
Anything that is delivered over an insecure channel.
What this generally means is that the developer of the web page is combining HTTP-based URLs with HTTPS-based URLs in the same page. The URLs could be for images as well as JavaScript, CSS, or anything else that can be referenced from a web page. As a user, there's not much you can do about this -- it's a warning that there is a possibility that your data could be delivered to other servers in an open, unencrypted manner over the Internet. This is a Bad Thing, but you can't do much except avoid that site, or contact the support or webmaster for the site.
If you're the developer, most of the time you can use a scheme-relative URLs when referencing images or javascript, etc.
i.e. Instead of this:
<img src="http://example.com/dot.png">
use this:
<img src="//example.com/dot.png">
YMMV.
See also: https://url.spec.whatwg.org/
In firefox you can see in Inspect Element=>Network Tab=>Domain Columns.
And also please check in Console tab too.
I hope it will solve your problem.
"Insecure" simply means "not loaded via HTTPS".
This is insecure:
<img class="media-object" src="http://placehold.it/50x50">
This is secure:
<img class="media-object" src="https://placehold.it/50x50">
"Some parts of this page are not secure, such as images."
means not all content are are loading with secure https you can use this online tool to determine which resource is loading with http whynopadlock
This is My Solution
To resolve this issue make sure that the page code does not pull data directly from a non-secure URL.
View the page source html code to check for non-secure items. This can be done in a web browser by doing a right click and selecting 'view source'.
To identify non-secure elements view the source code of the page and search for the text src="http://
This will then highlight elements on your page being loaded from a non-secure URL.
The source code (HTML) needs to be checked for NON SECURE tags. (i.e. http://www.symantec.com/images/seals/Secure...) Ensure the following references are changed to HTTPS or a virtual directory.
Note: The webmaster should always be consulted prior to any adjustments made to a web site.
Thank You and I hope this will Help out
For wordpress users that can't find any 'http:' in the page source check if you have a favicon set. Wordpress will default to their W icon (w-logo-blue.png) and I've had a couple sites continue to serve it from http even after fully converting to ssl.
Dashboard -> Appearance -> Customize -> Site Identity -> add a site icon
FOR IMAGES
First of all, check whether your image file has HTTP instead of HTTPS if so change it to https or rather save those images and put in in the Server.
For instance,
<img src="http://example.com/images/image.jpg">(http image source)
to
<img src="https://example.com/images/image.jpg">(https image source)or into
<img src="//example.com/images/image.jpg">(server image)
Firefox throws an error when you have mixed active content. This is having a combination of HTTP and HTTPs requests; it's a security issue as it leaves room for man in the middle attack- intercepting HTTP content requests with malicious or unwanted requests.
Tip: Check all the following urls in your active content:
< script >
< link >
< iframe >
< XMLHttpRequest >
fetch()
urls in CSS (#font-face,cursor,background.image)
< object >
Navigator.sendBeacon (look for url)
Another tip: make sure to check all files (css gets overlooked)

Joomla - Component URL rewrite in htaccess

I made an application in Joomla 3. Had a custom component in front end, which showing the details of a selected category.
Which the URL with out enable search engine friendly and URL rewrite as follows
wwww.sitename.com/index.php?option=com_arts&view=category&id=12
So I enabled the URL rewrite, SEO URL and URL suffix
http://www.sitename.com/component/arts/12.html?view=category
But I am trying to get a URL like this
http://www.sitename.com/caterory/12
I generated the link to this page using
<?php echo JRoute::_('index.php?Itemid=115&id='.$cat->id); ?>
Can anyone please help
Thanks in advance
To make the SEF router do what you want it to do, you have write your own router. You cannot, however, get rid of the component part of the URL.
Do do that, you do not need your own router, but a menu entry for each category. That menu does not have to be displayed, if you don't want to show it. The alias of that menu entry is then used for the SEF URL.
I think, this is what you are looking for
Supporting SEF URLs in your custom component
sef urls for custom component, which variant is better?