1

I don´t know if i writte right the links for use with URLs Friendly because for me don´t works

Actually i use this kind of links :

<a href="index.php?id=1578&title=Mike_Manager_Best&name=Mike">Test</a>

The case it´s if i use this kind of links don´t change nothing in the url, and finally show the same

If you can see my .htaccess, the url must be rewrite, but don´t change

<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} \s/index\.php\?id=([0-9]+)&title=([^\s&]+)&name=([^\s&]+)\s [NC]
RewriteRule ^ %1/%2/%3? [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([0-9]+)/([^/]+)/(.+)/?$ index.php?id=$1&title=$2&name=$3 [L]

</IfModule>

By this my question about if my links are right for use with my .htaccess with URLs Friendly, because when i click in link in the brownser in the part of url, dont show any change as for example :

http://test.com/1578/Mike_Manager_Best/Mike

Thank´s for the Help in advanced

Man
  • 33
  • 5
  • This seems similar as https://stackoverflow.com/questions/812571/how-to-create-friendly-url-in-php – hppycoder Apr 03 '21 at 18:26
  • My question it´s different my question it´s about if i put the links right, i speak about my format inside the links or i need put the links using other format, for works urls friendly – Man Apr 03 '21 at 18:37

1 Answers1

0

tl;dr Your internal links should be of the form:

<a href="/1578/Mike_Manager_Best/Mike">Test</a>

.htaccess doesn't change the actual link in the HTML source of your page. So, if you examine the link on the page (or hover over the link, to see the resolved URL), it is still as you have written it. All your .htaccess is doing is externally redirecting the "old" URL to the canonical URL.

However, your link is also relative (no slash prefix), so this is going to cause other problems when the browser tries to resolve it relative to the current URL (it won't work, unless all your page URLs are all in the document root). It should be /index.php?id=123... (with a slash prefix).

You NEED to actually update all your internal links to the desired root-relative (or absolute) canonical URL.

For example, instead of this:

<a href="index.php?id=1578&title=Mike_Manager_Best&name=Mike">Test</a>

It should be:

<a href="/1578/Mike_Manager_Best/Mike">Test</a>

The "redirect" in .htaccess is only necessary when changing an existing URL structure. To redirect search engines and 3rd party backlinks that you don't have control over. All your internal links should be linking to the canonical URL, as mentioned above.

If you don't change your internal links then...

  • You are not actually changing your URLs. The user can still see the "old" URL on the page and when they hover over the link. And this might be the URL that they share.
  • Whenever a user clicks on one of your links they will be externally redirected to the canonical URL. This is potentially slow for users and doubles the number of requests hitting your server. (Ok, it's a 301, so it should be cached by the browser, but hey - it's just not good.)
  • You are sending mixed signals to search engines. The search engines are going to crawl the URLs it finds in your HTML source (ie. index.php?id=123...) which then triggers a redirect to the canonical URL. This is going to be detrimental to SEO. You should always link directly to the canonical URL.
MrWhite
  • 43,179
  • 8
  • 60
  • 84