Edit…
Someone suggested I do it differently… If I were to use .htaccess, would this work?
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^chapter http://mysite.com/chapter/1
I’m just using basic javascript here, but I wanted to find out if there’s a way to add it to my jquery file so that the redirection will happen if the path matches something specific?
Right now, I’m using:
<script type="text/javascript">window.location.replace("/chapter/1");</script>
I’d like that to only occur if the user goes to http://mysite.com/chapter.
I’m not altogether clear on how to get the path using jquery and do a pattern match?
jQuery is a Javascript library which helps you manipulate DOM elements.
Since you’re not manipulating DOM elements, jQuery won’t do you any good.
You can use the
location.hrefproperty:Or,
However, you should probably do this on the server instead.