bootstrap nav tabs htaccess - .htaccess

I got problem with my .htaccess while i using bootstrap nav tabs `
<ul class="nav nav-tabs" role="tablist">
<li class="active">page1</li>
<li>page2</li>
<li>page3</li>
<li>page4</li>
</ul>
I need to change URL to www.domain.com/index/page1 or page2 ... but when i switching between them URL doesn't changed. And when use my .htaccess file nav tabs stop working. What should i type in a .htaccess file to get this URL or use script which i get ID name to the URL and then use this rewrite rule?
RewriteEngine on
RewriteRule index index.php#pane1 [NC,L]

press Ctrl+U You will find the error
The requested URL /registration/js/jquery.min.js was not found on this server.
it is because of our url may like www.example.com/#tab1 original is working
www.example.com/mydir/#tab1 is not valid, It should be written whole bootstrap css and whole bootstrap path to solve this issue.

Related

How to change http to https in Prestashop 1.6 add cart

I enabled SSL on my Prestashop 1.6:
Preferences > General > Enable SSL
Preferences > General > Enable SSL on all pages
In .htaccess I used a following code:
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
before
# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
Everything looks fine but in view page source of website still I see:
<a class="button ajax_add_to_cart_button btn btn-default" href="http://www.myeshop.com/cart?add=1&id_product=9&token=2db68311c3192a52b4eca5bc1b2c218f" rel="nofollow" title="Add to cart" data-id-product="9"> <span>Add to cart</span> </a>
A href link in Add to cart button directs to http instead https.
Can you help me please?
Regards
Jan
You should look at the smarty template concerned and seeing if classes or controllers are not overridden.
at least you can correct it, with Javascript with something like :
$(document).ready(function()
{
$('.ajax_add_to_cart_button').each(function() {
var href = $(this).attr('href');
href = href.replace('http:', 'https:');
$(this).attr('href', href);
});
});
But it's only for test mode not in production due to security !!!
please read this thread :
Change all occurrences of "http" to "https" on a wordpress page

.htaccess redirect: correcting image path from localhost/folder to domain.tld [duplicate]

I want to make my URL as SEO Friendly URL. I tried editing .htaccess file by rewriting rule
RewriteRule ^swift-details/([0-9]+)/([0-9a-zA-Z_-]+)$ swift-details.php?id=$1 [NC,L]
RewriteRule ^swift-details/(css|js|img)/(.*)?$ /$1/$2 [L,QSA,R=301]
It's routing the correct URL but in that page CSS JS and images are not working.
Example URL:
http://www.example.com/swift-details/2/abblinbb
This is because your relative URIs have their base changed. Originally, the base is / when the page is /swift-details.php?id=foo, and the browser properly fills in relative links with the / base. But when the browser goes to a page like /swift/details/foo the base suddenly becomes /swift/ and it tries to append that in front of all relative URLs and thus none of them load.
You can either make your links absolute, or change the URI base in the header of your pages (inbetween the <head> </head> tags):
<base href="/">
You dont need the second rewrite rule. Your CSS/JS paths are all 'relative' to your current location.
Your CSS exists here:
/css/normalize.css
Your page is looking here:
/swift-details/2/abblinbb/css/normalize.css
All you need is 'forward-slashes' before your CSS/JS paths.

why is my RewriteRule not working

I want to be able to Rewrite a following url:
www.mysite.com/en/contact
to something like this
www.mysite.com?l=en&p=contact
but keep the structure.
I tried the following RewriteRule:
RewriteEngine On
RewriteRule ^([\w-]+)/([\w-]+)/?$ index.php?l=$1&p=$2 [L]
but the browser then wants to load all the included scripts like the css from
www.mysite.com/en
How can I tell the browser, that it shouldn't follow the url link?
Or something like that
Thank you for your help
Chris
There are 2 methods to solve this:
1) Use base tag inside head tag
<base href='/'>
2)Use relative links
<link rel='stylesheet' href='/css/style.css'>
Here the browser looks for the CSS file in the folder in the root named CSS, whatever the URL request may be.

.htaccess and images redirect from another server

Wonder, I'm bulling a system that I will be able to upload to another hosting with domain just 1 file like: index.php and this file will calling to some other file in another server and print the html he got.
so right now, there is a option to do, when I print:
<img border="0" src="images/logo.jpg" alt="" />
something in the .htaccess or something will now that this image is on:
http://www.masterdomain.com/images/template_1/
?
I tried:
RewriteRule ^images/(.*)$ http://www.masterdomain.com/images/template_1/$1
but it's not working very well,
I need also css so I believe it's the same command.
Thank you all!
Try
RewriteRule ^images/(.*)$ http://www.masterdomain.com/images/template_1/$1 [NC,P]
The P flag will proxy your request to the masterdomain server

Problem using URL rewrite (Relative Paths not working)

I am using a .htccess file in order to rewrite my URLs. I am using the following rules in my .htaccess files
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^product/([0-9]+)/([A-Za-z0-9+]+)$ /product.php?productid=$1&prodname=$2
The rewrite worked fine.
But when i try to access any other page through relative path which is in all the cases, the URL is not getting redirected properly.
Like in the below example
<form action "something.php" method="post">
<input type="text" name="1" />
<input type="submit" value="submit" />
</form>
When I click on submit, the page that gets loaded is http://mydomain/product/1/something/something.php which does not exist and hence throws a 404 error
I tried using the base tag in the head but this creates problem while I am using page anchors and modal windows. It gets redirected to the index page.
Please let me know if further details are required.
I am fairly new to this. So, could someone please help me with this?
Thanks in Advance,
Kartik
This is a URL resolving issue. See mod_rewrite URL info required for details.
You can either use absolute URL paths or absolute URLs:
<form action="/something.php" method="post">
<form action="http://example.com/something.php" method="post">
Or you change the base URL (see BASE HTML element) so that every relative URL is resolved from that URL and not the current URL:
<base href="/">
<base href="http://example.com/">
The short and easy version of solving this is to absolute-path your URLs - /something.php in the form action, not just 'something.php'.

Resources