How i can modify url path likeexample.com/blog_id=4&comment_id=5
to just example.com
without redirection.
so the content gonna be of that long url but after
loading page it modifies it to that short url.
Asked
Active
Viewed 2,388 times
-1

which_part
- 792
- 3
- 11
- 26
-
You would usually start by writing some code. Have you tried that? It would improve your question immensely if you posted it – Tibrogargan Oct 21 '16 at 06:21
-
.htaccess is the answer google it and you'll find answers – Kevin Kloet Oct 21 '16 at 06:21
-
use ajax to load that page in the homepage – madalinivascu Oct 21 '16 at 06:22
-
take a look at this thread http://stackoverflow.com/a/39305628/842112 – Santhosh Nayak Oct 21 '16 at 06:23
2 Answers
2
Use javascript pushstate
to clear your URL after page load.
window.history.pushState("object or string", "Title", "/");

Santhosh Nayak
- 2,312
- 3
- 35
- 65
2
Your questions seems like .htaccess
good usage:
RewriteEngine On
RewriteRule ^/blog_id=\d+&comment_id=\d+$ example.com [NC,L]
You can also use JS window.history
for that:
var stateObj = {blog_id: 4, comment_id: 5};
history.pushState(stateObj, "", "example.com");
history.replaceState(stateObj, "", "example.com");
Difference: when pushState
and clicking back button you will be redirected to previous URL while replaceState
will redirect to actual previous page that you visited before using replaceState