.htaccess and Links

Problems with the Windows version of XAMPP, questions, comments, and anything related.

.htaccess and Links

Postby Peaky » 14. July 2018 13:11

Within my website I use many <a> tags to allow people to navigate.
I also have a .htaccess in the root directory to allow me to rewrite settings.php?setting=example to /settings/example/

Ever since i added this to my .htaccess the <a> links have all been linking you to a page in the root directory rather than in the directory it was clicked.
For example if i was in the projects folder and clicked on a link to Example-project <a href="example-project"> it would take you to /example-project/ rather than /projects/example-project/

I know a solution would be to change the link to /projects/example-project/ however there are so many links on my website that i would prefer another option.

This is my .htaccess

RewriteEngine On
RewriteRule ^settings/([^/]*)/?$ settings.php?setting=$1 [NC,L]
RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?page=$1 [NC,L]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} =""
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://www.example.com%{REQUEST_URI} [L,R=301]

Thanks in advanced,

Posts: 1
Joined: 14. July 2018 13:03
XAMPP version: 3.2.2
Operating System: Windows Server 2012 R2

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 65 guests