Remove the ?vietnam% extra string on URL - url

I have several links that duplicate the homepage. For example:
https://www.gameressential.com/?vietnam/2022-09-18102366_html
Also,
https://www.gameressential.com/?vn/2022-09-18122558_html
I wanted to permanently remove the /?vn/2022-09-18122558_html and /?vietnam/2022-09-18102366_html so that it will not show as an issue in Google search console. I already checked the htaccess and no codes added there. I tried to redirect but it is just a temporary solution. I need the permanent solution.

Related

Change Jekyll site baseurl without breaking links to existing posts

I have a Jekyll blog using the Minimal Mistakes theme. It's hosted through GitHub Pages, with a custom domain name. The github repo is called eg me.github.io. Currently, the blog is at something like http://www.example.com, so each post comes up like http://www.example.com/trouble-with-urls/.
I want to change it so that it's all at http://www.example.com/blog instead. I have added baseurl: "/blog" to my _config.yml file and now the posts are at the right place, http://www.example.com/blog/trouble-with-urls/. However, I now have two problems: all my image links are broken, and more importantly the links to individual posts are also broken.
Is it possible to automatically redirect posts? I looked at the jekyll-redirect-from gem, but I don't really understand it. It looks like the baseurl is automatically included in the path for the redirect_from: and I can't work out how to ignore it. The readme for that gem says, for customising, "Simply create a layout in your site's _layouts directory called redirect.html." Is there something I can do with that?
Actually I would also like to change the permalinks as well, to add dates, but I'm trying to focus on one problem at a time! Eventually the final URL of each post should be like http://www.example.com/blog/2021/02/13/trouble-with-urls/.
For the images, they are currently all hardcoded like ![url trouble](/assets/images/2021-02/ugh.png). I can fix the path by adding in "/blog", to make it ![url trouble](/blog/assets/images/2021-02/ugh.png) but I think this might be a bad way to link images anyway. I saw that there are {% %} tags for links but can't find any resources about using them for images. Is it possible?
I managed to get this working, so here's what I did in case anyone else tries similar in future.
Adding a baseurl in _config.yml didn't work. Instead, I duplicated my repo, to take advantage of Github Pages' allowance for 1 User site but many Project sites.
One repo remained as me.github.io. I renamed the copy to blog, and added a gh-pages branch. This made GitHub automatically deploy it at me.github.io/blog.
Within the blog repo, I changed the permalinks to the style I wanted. The images were fine as the relative paths hadn't changed.
Within the original me.github.io repo, I first changed the home page (by editing the Minimal Mistakes html files) to hide all posts. Then I added a link at the top of the page to their new home, at me.github.io/blog. The blog is now successfully a subsidiary of the main site.
So that old links wouldn't break, I kept all the existing post files in the me.github.io repo. I used the jekyll-redirect-from gem to add redirects into each post for the new address. This was done by manually adding a line into the Front Matter of each, saying eg redirect_to: http://www.example.com/blog/2021/02/13/trouble-with-urls/. I also deleted all the post content of these posts, so only the Front Matter was left.
All future posts will be made within the blog repo, and so they will have the correct URLs.

Changing the name of the Page alias

In Kentico 8.2 the sub-page in the URL is misspelled. The Name Path is spelled correctly.
I see that under Pages > Properties > URLs there is a place to change the alias name. Will correcting the spelling here affect anything drastic change in the website (say, in the code)? I'd be inclined to say No, but I wanted another opinion.
Technically speaking of you make the modification/update Kentico will keep an alias of the misspelling so if anyone has reference to it, they can go to that bad URL and be redirected.
If there is custom code looking for that misspelled URL then it will have to be corrected but as you stayed probably not.
If webparts or widgets refer to that misspelled URL in the path property, they will have to be corrected. You will notice this right away on pages of they are referencing that misspelled URL because your content won't show up.
If you change the page-alias it will add the old alias to the list of page aliases (ie. old links to the page should still work).
Are you specifically using that page-alias in code anywhere to identify the page?
similar to:
var aliasPath = tree.SelectNodes()
.WhereLike("DocumentName", "Tutorials").FirstObject.NodeAliasPath;
but referring to the alias field instead.
Would the page be linked in any wysiwyg editors? I'm not sure if behind the scenes kentico would use page-alias in this instance or the document guid. Although if you retained the old misspelled alias then existing links should work.

Need to detect if a url contains a certain folder and if it does strip that folder out

We recently moved our communities to the cloud and with that we moved all subfolders up one level.
So, previously we had:
www.mywebsite.com/abcd/otherstuff/index.htm
And now our folder structure is:
www.mywebsite.com/otherstuff/index.htm
We've stripped out the abcd from all URLS in the website itself. The problem is, there's lots of tech notes and bookmarks out there in the world that still point to the old URL and they are getting a 404 and a lot of people are not happy.
Is it possible to write a script that enables our communities to detect the presence of abcd in the URL, strip it out, parse the remainder and direct the browser to the correct address?
What language would one write this in? Would it go in the HTTACCESS file? Has anyone done anything similar before?
Thanks.
I haven't done it but you may find this information useful: http://coolestguidesontheplanet.com/redirecting-a-web-folder-directory-to-another-in-htaccess/

Wordpress URL change

I have recently moved my wordpress site from "test.xxxxxx.com" to "xxxxxx.com" They are both identical except I just want to get rid of the "test" portion of my url on my index page and all my links. They are both on the same FTP and server. I transferred my site and have the homepage url working correctly but when I click on any of the links it still says "test" in front of the url. I have tried a couple different search and replace plugins with no luck. Is there a better way to go about this?
Wordpress has a problem that it doesn't update the permalinks easily. So, maybe you will have to change the permalinks manually in the wordpress database.
Use Better Search Replace plugin in order to fix old urls in your database.
After downloading and activating the plugin, you juste have to type old url to find and by which url to replace it, in your case you have to do it twice :
test.xxxxxx.com to xxxxxx.com
and
test.xxxxxx.com/ to xxxxxx.com/
I advice to do it twice because sometimes the plugin make difference between these two (strict string comparison I think) and wil not modifiy everything with only one command

How do I link to a PDF file in Silex?

I've looked around a bit and can't seem to figure out how to link to a static file while using Silex. I've seen some similar questions/answers in regards to Symfony, but they involved YML routing files, which I don't use with Silex.
My Situation
I have some files in a /docs folder. Logged in users can upload new pdf files (so, I don't know ahead of time what all of the filenames will be; they're constantly changing).
My Intent
I need to be able to link to these PDF files, so that a click on a link somewhere will open www.myurl.com/docs/myfile.pdf.
The Problem
Due to the routing system in silex, it treats the url as a route (obviously) and throws a Page Not Found error.
Thanks in advance for any feedback!
You need to configure your web server in a way that it does not forward existing files to the front controller. The web servers section of the silex documentation has examples of such configurations for the most popular web servers.
As for the link itself, just link to the file directly, something along these lines:
{{ filename }}

Resources