shuboy2014 shuboy2014 - 5 months ago 52
CSS Question

How can i redirect to another page by click on hyperlink in Html?

i have a navigation bar ,

current url : www.domain.com/what-is-your-fb-username-?/

<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="">Shuboy2014</a>
</div>
<ul class="nav navbar-nav">
<li class="active"><a href='delete/'>Delete</a></li>
<li class="active"><a href="edit/">Update</a></li>
<li class="active"><a href="logout">Logout</a></li>
</ul>
</div>
</nav>


when i click on logout option on navigational bar it redirect to www.domain.com/what-is-your-fb-username-?/logout and i want to go to www.domain.com/logout .

how can i do this ? Any helpful suggestion will be helpful .

Answer

You may change the href url of logout:

From: <li class="active"><a href="logout">Logout</a></li>

to: <li class="active"><a href="/logout">Logout</a></li>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
    <script src="https://code.jquery.com/jquery-1.12.1.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" href="">Shuboy2014</a>
        </div>
        <ul class="nav navbar-nav">
            <li class="active"><a href='delete/'>Delete</a></li>
            <li class="active"><a href="edit/">Update</a></li>
            <li class="active"><a href="/logout">Logout</a></li>
        </ul>
    </div>
</nav>