Website redirecting inproperly - apache

I have the following issue, I'm building a website and it's deployed inside a subdirectory of my server, the website is a referral for sales services. Then on the homepage I have two links that references the two main categories of the products sold in it. Now the first link href's is /es/sports/ if I click on it I get a 404 error but if I copy paste the url in the browser then the page is shown correctly.
Note, when I click the link it is redirected to /sports/ instead of /es/sports/ as corresponds.
Maybe some htaccess configuration on the root of the public folder?
It's a laravel powered website.
The website url is the following. http://entrenamiento.com/es/ the links are the ones on the left sidebar.

First of all thanks for all comments and help. The thing is as follows, the parent website on the htaccess file has no support for trailing slashes after the URL. So once the trailing slash rule is enabled then the website works as expected. Thanks again

Related

URL with trailing slash does not load scripts and CSS in PHP site

what is the difference between these two URLs:
abc.com/company-profile.php
abc.com/company-profile.php/
When I directly open the first one (without trailing slash) the page open perfectly.
But when search it in Google I get the second link (with trailing slash) and when I click on this link, the page only shows code, no script or css included.
After clicking on any style.css, the page shows like abc.com/company-profile.php/css/style.css.
What is happening?
The cause can be that Google indexes your website with a sitemap.xml file having the company-profile.php/ url and not company-profile.php.
And unfortunately your website doesn't manage well the trailing slash at the end of the url (you can fix this with updating .htaccess file)
You have to check the sitemap generated and downloaded by Google.
The url's sitemap name differs according you are using Wordpress, Drupal or another CMS, or a custom website...

Apache redirect to https and modify url structure

Goal:
Redirect from http://example.com/library/page123.htm
to https://example.com/library/folder/page123.htm
I have found plenty of example on how to perform redirects to ssl and how to add folders, but am struggling to execute these together. Additionally, there are multiple pages under the "library" folder of the old url structure.
Appreciate any help!

Redirect all subsites to one site

I have a website running on Apache. The address is http://helpdesk.example.com/otrs/customer.pl
I would like to create a forward such that if I access http://helpdesk.example.com/otrs/anyname (except customer.pl) this redirects to http://helpdesk.example.com/otrs/customer.pl
Also I'd like to not show the path of the website in the URL:
http://helpdesk.example.com/otrs/customer.pl displayed as http://helpdesk.example.com/
Thanks you for help!

.htaccess URL rewrite rule needs rewrite, but no need redirection

I have a main portal site and many sister sites. They all are hosted in a same hosting server.
All photos uploaded by the sister sites reside in the main site photo directory.
I have a URL rewrite rule in each .htaccess of all sister sites.
RewriteRule ^files/photos/(.*)$ http://mymaindomain.com/files/photos/$1 [NC,L]
According to this rule, all photos browsing from the sister sites would be mirror to the main site photo directory.
It is perfectly working fine when the image source is using in <img> tag.
<img src="http://mysistersitedomain.com/files/photos/blah.jpg" />
The problem is that when I open the URL in the browser (using "Open link a new tab" from the browser context menu), it is redirecting to http://mymaindomain.com/files/photos/blah.jpg.
I don't want the redirection because I don't want the users see that the photos reside in my main site.
I just want to keep the URL as it is in the <img> src. How can I do that?
It does work as I expected in my localhost.
http://localhost/mysistorsite/files/photos/blah.jpg is showing the image of http://localhost/mymainsite/files/photos/blah.jpg, but it keeps the URL unchanged.
So far I have known is that a redirect will not be issued to the destination unless I use the flag [R]. Otherwise, the current protocol, servername, and port number will be used to generate the URL sent with the redirect.
[Edit]
Here is my current directory structure in the server. Please assume that my sister sites are so far using sub-domains. Later I will have the sister site domains at the same level of mymaindomain.com.
/var/www/vhosts/mymaindomain.com/
|__httpdocs
|__files
|__photos
|__mysister1.com
|__mysister2.com

Redirecting Pages: Names to Standard Address

I have WordPress installed in the root of a website, and recently enabled a custom permalink structure just for the sake of having good looking page URLs (only pages are used in this website, no posts at all — it's not a blog). Unfortunately this is causing some problems with other parts of the website, outside WordPress.
So I'd like to go the manual way: and redirect URLs like /my-page to /?page_id=32 just for a selected amount of pages. Is it possible to do that using the .htaccess file? What would the rules look like?
If you're redirecting pages from Wordpress to other URLs, you can use .htaccess. But it's probably easier to use a plugin to redirect rather than edit .htaccess.
See WordPress › Redirection « WordPress Plugins to easily set up redirects and log redirects, errors, and more.