When I request the page on the hosting device it directs me to the local system files. If I request the page from a different device it returns the correct index.html page. This is the anchor element being used for the request.
<a id="indexLink" href="/"><img src="images/logo.png" /></a>
Why is the host machine directed to the system files?
I am currently using Bootstrap to add an accordion function to a jobs page on a new website. Everything works fine, however when I click to view a specific accordion to display the listing, the URL only works like this:
website/jobs#developer and not like this:
website/jobs/#developer which would look a lot more professional on job boards and maintain what we have on our current site.
I don't want to have to go back to every link distributed and remove the slash. I am attaching what I have done in my htaccess but I am not sure its is affected by it. Please help!
ErrorDocument 404 /views/errors/404.php
RewriteRule ^(jobs|Jobs|JOBS)$ views/jobs.php [L]
I'm overhauling a website that someone else built for my organization. It was originally set up with "not so great" anchor links which included spaces. I have replaced those anchors with new ones that will work better.
One of the old anchors looked like this
/course/#To Have which browsers would luckily convert to
/course/#To%20Have. I changed that anchor to this:
I'm now wanting to make sure that any anchors that may have been shared on social media or that could be linked to from other websites still work; I was planning on doing this via redirect in the .htaccess file, such as this one:
Redirect 301 /course/#To%20Have /course/#to-have
After some research I've found that this is not possible due to the
# in the URLs. And I also have not seen examples where an anchor was redirected to another anchor.
Is this possible?
I have a static single page website, however I'm trying to figure out how to "link" to each section of the page giving a unique URL and being able to show in the browser history.
I don't even know where to start - I tried .htaccess with:
RewriteRule ^services/?$ /index.html#services [NE,R]
However the URL updates with the # rather than keeping the /services/ link (although it does redirect correctly).
Clearly this isn't the solution because
- It adds the hash back to the URL
- Does not show in users browser history properly
There is a solution to avoid escaping characters when URL are rewritten by Apache : the NE flag.
My problem is that it seems not to work for me, and I am also looking for a way to insepc the final URL (the one after the redirection).
My htaccess is :
RewriteRule ^carte /offers.php?#promo_code [NE]
I tried to reach the adress, and the anchor is working well (http://localhost:8888/offers.php#promo_code => this works well !)
But when I use http://localhost:8888/carte it redirects to offers.php page, not the anchored element.
Any idea ?
Im' trying to achieve that the document goes to the anchor name given with a friendly URL.
RewriteRule ^files/page/([a-zA-Z0-9\-]+)?$ myPage.html#$1
But this doesn't works.
I tried it inserting the url with the page:
myPage.html#myAnchor and worked fine. So the problem must be in the htaccess line.
I searched and found this old question with an answer that seems it works, but unfortunately not for me.
HTACCESS file (updated with [L] flags):
AddType text/x-component .htc
RewriteRule ^ahorro/?$ ahorro-para-mi-futuro.html [L]
RewriteRule ^ahorro/como-es-nuestro-ahorro/([a-zA-Z0-9\-]+)?/?$ como-es-nuestro-ahorro.html#$1 [L]
RewriteRule ^ahorro/preparado-para-tu-jubilacion/?$ hasta-que-punto-estas-preparado-para-tu-jubilacion.html [L]
RewriteRule ^ahorro/ventajas-fiscales/?$ ventajas-fiscales.html [L]
RewriteRule ^ahorro/para-mi-futuro/([a-zA-Z0-9\-]+)?/?$ por-que-deberia-ahorrar-para-mi-futuro.html#$1 [NE,NC,L]
RewriteRule ^preparar-jubilacion/?$ preparo-mi-jubilacion.html [L]
RewriteRule ^preparar-jubilacion/calcula-tu-patrimonio/?$ calcula-tu-patrimonio.html [L]
RewriteRule ^preparar-jubilacion/calculadora-gastos/?$ calculadora-de-gastos.html [L]
RewriteRule ^preparar-jubilacion/disponibilidad-de-ahorros/?$ como-podre-disponer-de-mis-ahorros.html [L]
RewriteRule ^preparar-jubilacion/4-pasos-para-mi-jubilacion/?$ 4-pasos-para-planificar-tu-jubilacion.html [L]
RewriteRule ^vivir-jubilacion/?$ vivo-mi-jubilacion.html [L]
RewriteRule ^vivir-jubilacion/prioridades/?$ que-necesito-y-cuales-son-mis-prioridades.html [L]
RewriteRule ^vivir-jubilacion/disponer-de-mis-ahorros/?$ como-podre-disponer-de-mis-ahorros.html [L]
RewriteRule ^vivir-jubilacion/4-pasos-para-mi-jubilacion/?$ 4-pasos-para-planificar-tu-jubilacion.html [L]
RewriteRule ^encuentros/?$ encuentros-futuros.html [L]
RewriteRule ^calculadoras-y-simuladores/calculadora-ahorro/?$ calculadora-de-ahorro.html [L]
RewriteRule ^calculadoras-y-simuladores/calculadora-gastos/?$ calculadora-de-gastos.html [L]
RewriteRule ^calculadoras-y-simuladores/calcula-tu-patrimonio/?$ calcula-tu-patrimonio.html [L]
RewriteRule ^politica-cookies/?$ politica_cookies.html [L]
I'd like to make a rewrite rule that only operates if a specific term is found in the url.
So if the
targetterm is target and the url is:
I want it to become:
But if the url is, for instance:
I want nothing to happen.
Is there maybe someone who has a clou?
I have some links and I want them to be shown under the same name on the browser.
For example www.link.com/index.htm or www.link.com/#anchor to be shown as www.link.com
I have tried that using css by putting that:
link.address.href = link.address.href.replace(/#.*/,'')
link.address.href = link.address.href.replace(/i.*/,'')
but it doesn't work. I cannot find the possible ways to do that. I can think of :
CSS way which is the easiest for me, JS but I am not that literate in this
and htaccess file creation. Although I have to be careful because I am not sure which server I am going to use. Which one is the best?
What am I doing wrong with the css modification above?
On a page called
somepage.php, I have the following HTML. I might be changing the name of the file, so I would rather not hardcode
Is this possible, and if so, how is it implemented?
EDIT. I don't think I was clear. How could I modify the below code so that functionality is identical, however, it doesn't include "somepage.php" in any of the anchor or form attributes.
<form action="somepage.php" method="post">
<input type="hidden" value="controller_1" name="controller" />
<!-- other stuff -->
<form action="somepage.php?controller=controller_2" method="post">
<!-- other stuff -->
I am trying to url redirect this url :
I have tryed both these rules, but it doesn't seem to work.
RewriteRule ^article-([a-zA-Z0-9_-]+)-([0-9]+)\.php#([a-zA-Z0-9_-]+)$ article.php?id_video=$2#$3
RewriteRule ^article-([a-zA-Z0-9_-]+)-([0-9]+)\.php#([a-zA-Z0-9_-]+)$ article.php?id_video=$2#$3 [NE,R]
But it doesn't work...