I've got ajax links as the following:
www.domain.com/profile#dashboard
is it possible to change this via htaccess into:
www.domain.com/profile/settings
If so, how? :D
EDIT:
This is my loadPages .js file:
(document).ready(function() {
if (location.href.indexOf("#") > -1)
location.assign(location.href.replace('#', "/"));
//preload pages
if(window.location.hash) {
//Loading
var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
loadContent( hash+".php" ); }
});
function loadContent(pagina) {
jQuery("#page").load(pagina);
}
This is my .htaccess file
RewriteEngine On
RewriteBase /
#Hide de submap pages
RewriteRule ^$ pages/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ pages/$1
#Hide de logged-in file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ logged-in.php?$1 [L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/logged-in\.php [NC]
RewriteRule ^ %1 [R=301,L]
This is how I link pages to open in the #pages div - dashboard page as example
<a class="iconNav" href="#dashboard" id="loadDashboard" onclick="loadContent('dashboard.php');">
I updated my .htaccess file. Now the links look like:
www.domain.com/#dashboard
I want it to be:
www.domain.com/dashboard
You can use location.assign ( url )
method to change URL in the browser:
if (location.href.indexOf("#") > -1)
location.assign(location.href.replace('#', "/"));