Hello,
I have a div in my index page whose id is "charts", so if I give "index#charts" as a value in anchor tag its works fine but now I have added .htaccess in my project for pretty urls.
Every other page is working fine, and I have write a rule in my htaccess that, if the url is "all-charts/chart-name/year" then redirect to "index#charts". My problem is that now its opening index page but not scrolling down to that div.
If I directly type "index#charts" in url its working.
Any idea what I am doing wrong?
Its kind of a complex structure, as I have a URL class which check all the request and returns the appropriate page. For example if I want to return the page named "blog.php" then in the link I will use "?page=blog" or for page "user_forum.php" i will give the href attribute value of "?page=user_forum". But now I am trying to change it to seo friendly url.
This is my htaccess code
RewriteEngine On
RewriteRule ^(backend)$ /backend/?page=index [NC,L]
RewriteRule ^(backend)/?page=([a-zA-Z0-9-_]+)$ /backend/?page=$1 [NC,L]
RewriteRule ^(blog)/([a-zA-Z0-9-_]+)$ /?page=read_blog&slug=$2 [NC,L]
RewriteRule ^(all-charts)/([a-zA-Z-_]+)/([0-9])$ /?page=index#charts [NC,L]
RewriteRule ^([a-zA-Z0-9-_]+)/([0-9]+)$ /?page=$1&cp=$2 [NC,L]
RewriteRule ^([a-zA-Z0-9-_]+)$ /?page=$1 [NC,L]
And in anchor tag i used something like this
<a href ="all-charts/january-chart/2018">January 2018</a>
Thanks,
Anchal Bhargava
What I have tried:
I double check all the spelling in htaccess rule and in anchor tag. I tried changing the id. I added a footer message so there is a content beneath it