0

I am writing seo url for my website. in homepage everything is fine with all links in menu. after click http://www.example.com/article/article-name i see the content but my menu url also change for that page like www.example.com/article/menuoption1 but actual url is www.example.com/menuoption1 . how i can solve this issue and any other changes required in my code.please help

Options +FollowSymLinks   
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^article/([a-zA-Z0-9_-]+) article.php?article=$1 [NC,L]



RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]
Swapnil P
  • 3
  • 1
  • 1
    When you click the link it rewrites or the link itself changed? If the click make the path absolute. So `href="/menuoption1"` instead of `href="menuoption1"` – chris85 Oct 16 '15 at 19:46
  • yes its works but same time /article are include in all links in http://www.example.com/article/article-name page – Swapnil P Oct 16 '15 at 19:49
  • Thank you so much..problem solved – Swapnil P Oct 16 '15 at 19:51
  • thank you for more information. the problem is solve with /menuoption1. feeling great to here with you guys. – Swapnil P Oct 16 '15 at 19:54

1 Answers1

1

href="menuoption1" is a relative path meaning it will point the user to the current directory they are on.

So if on /article. The user will get

/article/menuoption1

to resolve that make it absolute:

href="/menuoption1"

This way that link when on any page will go back to the root of the domain /.

chris85
  • 23,846
  • 7
  • 34
  • 51