301 redirect in NuxtJS - vue.js

I am trying to work out a way to make 301 redirects in NuxtJS.
Is there a way to use router push and make it act/perform like a 301?
I currently have this
this.$router.push(`/${this.res.goTo}`);
in my mounted() function, this is good but it does not tell the browser it's a 301 (network tab)
Now, is there a way to redirect to another page and tell the browser it's a 301?
Using nuxtjs with SSR.

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

Open vue subroutes with params from extern website

Is it possible to open an vuejs subroute from an external page with nginx? E.G
https://www.vuejsapp.com/subroute/param123
My current result is redirect to the nginx 404 page.
Thanks for help,
best regards and stay healthy!
Vuejs router uses html5 pushstate for routing, which happens only in client side it means when a route changes it has nothing to do with server side and when external request comes to vue, first goes to server side and sees there is not path matching url and returns 404 so the only thing you should do is to rewrite all http requests to index.html file in that case server side will send all requests to index.html and then vue js will handle routing and finally your component will be mounted.
if your web server is apache you should do this (rewriting all requests to index.html) in .htaccess file

Prestashop 1.7: How to set CMS page as homepage

Can anyone please help me with is question here. I want to set a CMS page as homepage in prestashop 1.7 and still able to keep the old default Prestashop homepage as my Shop button link in menu still?
Best way is to make a redirection, because on the Prestashop backend you cannot do that easely and it could harm your website. You can also build your own Html and integrate it on the homepage via a module.
But best seems to be with a redirection :
Your server uses apache, just add this line to the .htaccess :
Redirect 301 /retiredpage.html /newpage.html
Your server uses nginx, add this line to your configuration : rewrite ^/retiredpage.html$ /newpage.html permanent;
You don't know and you don't want that ? Just use a redirection module, there are many on Prestashop Addons.
On the index.php page at the root of the site, replace the code with that:
require(dirname(__FILE__).'/config/config.inc.php');
if(Tools::getValue('home')) {
Dispatcher::getInstance()->dispatch();
} else {
$link = new Link();
Tools::redirect($link->getCMSLink(ID_PAGE_CMS));
}
Then if you go on the homepage you will be redirected to the CMS page for which you have indicated the link, to go via the menu on the real home page, add? Home at the end of the url of your website www.yourwebsite.tld? home

use express.js stating web server,and fontend use vue.js

Using vue.js(including vue-router) to make up the view and using express to make up the backend.
My question is that how to rewrite then URL with using SPA.
for example, start width then URL http://localhost:8080 and link to http://localhost:8080/foo it works, but when I refresh the page in URL
http://localhost:8080/foo it shows me 404 error.
So how can I write the URL like the function of .htacess in apache to rewrite the URL?

How to count outbound 302 redirect clicks on Apache Linux server?

I own domain 1 and would like to redirect to domain 2 (no affiliation) using a 302 redirect or another temporary automatic redirect method if more suitable. Is there a way to count/track the redirects taking place using this method?
Alternatively, I can put a link on the page and instruct people to click that link at which point, I know how to track it.
The automatic redirect method is preferred.