loop in URL, How fix this? - .htaccess

I generated a sitemap.xml but prints url element multiple times in loop
Example
http://www.domain.com/en/en/en/en/en/en/legal-advice
How I fix this? The page is in PHP with framework Codeigniter.

Related

Odd URL RewriteRule Behaviour

Hoping someone with better experience can guide me on this.
Ref: https://www.donbur.co.uk/gb-en/news/index.php
This is a dynamically generated news summary list with a button link to article pages. Until last week, the button links worked fine.
Each link calls a URL
<a class="button" href="https://www.donbur.co.uk/news/<?php echo rawurlencode($row_newsResult['newsurlkey']);?>">Read full article</a>
This parses fine.
To process this link, I've then got an htaccess RewriteRule:
RewriteRule ^news/([^/]*)$ /gb-en/news/article.php?title=$1 [L]
The article.php file then uses the unique title to identify and show the full article.... or at least that's what it should do and has done.
For whatever reason, from the news index.php page, when the link is clicked, it just refreshes the page and re-writes the URL to
https://www.donbur.co.uk/gb-en/news/index.php/[uniquetitleparameter]?title=[uniquetitleparameter]
The parts in brackets [] obviously get populated with the rawurlencoded string.
I cannot for the life of me understand what is happening here - especially when I have a similar page, doing a very similar thing, works absolutely fine (https://www.donbur.co.uk/gb-en/features/feature-list.php)!!!!
This all started going wrong when I converted the site from http to https: but can't work out if that's relevant??
Turns out this was just a bad caching issue. Temporarily disabled cache as suggested and all works well.

codeigniter making duplicating pages with #! include in link of each page

I have an issue on my website which is on CodeIgniter.
All links are making a duplicate copy of each with #! included in URL
for example
https://www.example.com/port-of-portsmouth
link to a page on my website which is duplicated like the below link
https://www.example.com/port-of-portsmouth#!
Both links have the same page content. How to get rid of this error to avoid content duplication
How to get rid of this error to avoid content duplication
You can't
Because # is used as a fragment identifier. For an example, if the URL is https://example.com/#data this means that open the example.com and jump to a specific section of the page with id"data"
See this URL, https://jestjs.io/docs/en/cli.html#cache
When you open the page, it jumps to cache section.
So, basically, your content is not duplicated, it's just opening the same page and then browser tries to navigate to id !, which might not be there and hence nothing special happens.

How to find URL of page returned from XmlSlurper.parse(aURL) after redirect in Groovy

How do I in Groovy get the URL of a page returned from XmlSlurper.parse(aURL) after redirect. Wild guessed and tried parser.getProperty("document.location") without luck.

how to remove id of div in url with htaccess

I am having in an url the id of a div (#latest) like this at the end:
http://example.com/discussion/64/moderators-only#latest
http://example.com/discussion/32/bugs#latest
// and so on...
How can i remove the #latest in all these url's with htaccess?
You can't. Anything after the # is a URL fragment that the browser never even sends to the server. So the only thing the webserver sees is: http://example.com/discussion/64/moderators-only. So nothing in the htaccess or even in the apache config can do anything about those fragments.
You'll need to employ some sort of javascript or client-side solution if you want to remove it. But a better question is, do you need this in order to display the content correctly? If so, then how do you expect to display the content if this is gone?

Redirect parent not childs htaccess

In my magento module there is an extension.
Some urls like
http://www.domain.com/abc/p#abcs.html
http://www.domain.com/abc/p#xyz.html
etc
But when browsing http://www.domain.com/abc/p -> lead to blank page
I do not need http://www.domain.com/abc/p url
Is anybody help me
I want to redirect the url http://www.domain.com/abc/p to 404 page
without affecting its childs
ie
1. http://www.domain.com/abc/p#abcs.html
2. http://www.domain.com/abc/p#xyz.html
Points to its current position and
http://www.domain.com/abc/p to 404
Any help apperciated
Based on your comment it seems http://www.domain.com/abc/p#abcs.html shows proper content but http://www.domain.com/abc/p shows blank page.
In that case you can't do that via .htaccess because on server side URL will always be: http://www.domain.com/abc/p.
You need to put some custom Javascript in your page and redirect to some non-existant page (resulting in 404) by checking location.href using your Javascript.

Resources