I'm rewriting my portfolio website urls by using the following code in a htaccess file,
It all works until I want to navigate to another page from the blog-post.php page for example, let say I want to go to the about page the url becomes cgarcia.design/web/about and it should be cgarcia.design/about so the page can load properly. Now what would I need to change in the htaccess file to accommodate files within folders? my nav structure is the following
Thank you for any suggestions. asked 03 Jul '15, 06:40 cgarcia2595 seanf
showing 5 of 7
show 2 more comments
|
Could you perhaps provide the actual URL where this is happening?
http://cgarcia2595.webfactional.com/web/thirsty-for-knowledge
I see a 403 response at that URL, so I can't troubleshoot the problem you're reporting.
http://cgarcia2595.webfactional.com/blog-posts/thirsty-for-knowledge
Okay I was able to fix the issue, however, if you navigate let say to another page from that link, the blog-posts does not get remove from the url.
a normal url would look something like this http://cgarcia2595.webfactional.com/about
That's not a problem with your .htaccess - it's a problem with code or templates used to render your pages.
For example, your "about" link is coded like this:
Since it's a purely relative link to "about", if you click on it while below http://cgarcia2595.webfactional.com/blog-posts/, then it will go to http://cgarcia2595.webfactional.com/blog-posts/about.
What you want is probably like this:
So, try editing the code or template that renders those links so that the links include a leading slash.
It works great! Thank you!
One last question if I wanted to force a trailing slash in my urls how would i change the code I have above?
That's a separate rewrite rule -- something like this.