is there a way to edit .htaccess so that when I include links on my HTML pages with the <a href> tag, I can abbreviate links within the same site? For example, if I want to have a link from
index.html in the parent directory to /plans/index.html (which is a subdirectory) I want to be able to just write <a href="/plans/">Here</a> in the HTML. Conversely, when linking back to index.html on the parent directory, I'd want to just write <a href="/">.
I tried fooling around with .htaccess to redirect links but apparently it does it only when that link is entered into the browser by the visitor. Is there another way to be doing this? ANy help would be appreciated!

Recommended Answers

All 2 Replies

That should work without modification to your .htaccess file.

The only thing that might be an issue would be indexing. So if you see a list of files in the directory instead of the page you expect then try adding the following lines to your .htaccess file:

#this will turn off indexing (the list of files
Options -Indexes
#this will make a /directory/ link point to index.html
DirectoryIndex index.html

Thanks for the suggestion! but unfortunately no luck... when I click the link it still gives be a "not found" error page. I double checked the link and if I placed the file in the right place but no problems there... just a question though.

is there a difference between
"IndexIgnore *" and "Options -Indexes" in the .htaccess file?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.