I have this pure HTML web site published on GoDaddy. What I want to do is create some friendly URL, such as: www.mywebsite.com/friendly-url
The easiest way of doing it is to create a folder called "friendly-url" and put a index.html file on this folder, right?
Is there any easier/correct way of doing it?
And the second question would be: can I create like an alias for a specific page? Let's say I want these both URLs to point to the same page:
www.mywebsite.com/friendly-url
www.mywebsite.com/furl
Please keep in mind this is a simple and pure HTML web site hosted on GoDaddy and I only have access to cPanel.
Thanks a lot for your help!
You can use Mod_Rewrite by putting a .htaccess file in your web root directory. this could help you a little more on how to do it: http://corz.org/server/tricks/htaccess2.php
--Edit
You can also have a visit at this website: http://code.tutsplus.com/tutorials/an-in-depth-guide-to-mod_rewrite-for-apache--net-6708
Related
I am having an HTML site https://example.com. I have a page named example.html. I want to make my page URL https://example.com/exam/example.html. Where exam is another page.
How to do this in HTML website?
I am using:
but this is not like what i want. How to do this?
I'm pretty sure you'd have to create a directory called exam and have a file called example.html in that directory in the place that serves the domain example.com. :-)
This can't be done as HTML + CSS are both for client side, if you would have made a server then from server side you could have changed this using route.
I want to make a simple little website, but I'm honestly not quite sure about how to structure the files.
To display a html-page under the link
samplesite.com/test
should I rather use:
main/test/index.html
Or:
main/test.html
Regardless the domain, the web browser will always look for the index.html of your project. So the domain.com/index.html is the way to go.
Answering the question based from the title. For html file structure, it is good to have the index.html on your root/project directory this:
Putting other web assets in different directory will help you to have a better file organization, you can also download some design/templating framework like zurb foundation and check the file structure.
The main page (opening page ) should be index.html coz when you upload it on apache /public_html folder by default it looks for index.html (or php in case you use php) so if your website is www.dummy.com ,by default when you go on it it serves index.html and to get test.html you have to use www.dummy.com/test.html
I just came up with an idea. Instead of using an .htaccess file to remove .html from the URL, why not just use a simple folder structure and in each folder add an index.html?
For instance:
example.com/index.html → Home
example.com/about/index.html → About
Now simply use a hyperlink on the homepage to the about folder, since typically index.html files are opened automatically.
The upside of this kind of navigation, is that it would be easily possible to create sub pages with no crazy database / .htaccess setup.
Now my question is: is there any reason not to create a webpage like that and is it legitimate to use multiple index.html files?
I appreciate all the help.
With the index.html route, there would be three URL's that can access the same page. For example for an about page:
www.yourwebsite.com/about
www.yourwebsite.com/about/
www.yourwebsite.com/about/index.html
Using the .htaccess file would likely give you more benefit from an SEO perspective. You can tell the search engine which one to use, by using 301 redirects. See more about how Google does this here:
https://webmasters.googleblog.com/2010/04/to-slash-or-not-to-slash.html
Of course you could set up your website using folders and index.html's, and still
use the .htaccess file to take care of the SEO. But, depending on your sites size and structure, this might be more work.
The only downsides would be having to create a folder in addition to a file whenever you want to create a new page, and having to take more time to navigate into a folder in order to edit a page.
As long as you are using Apache, or a similar server software, multiple index files will function normally and be served from each folder.
I want to make a single page HTML site. I have made the template, but I wanted to know how to make it go live on my hosting.
I have tried many things but none of them work, I don't want to use any CMS, just a plain and simple HTML site. I have both a domain and hosting.
If as "template" you mean HTML file than you should name your file as index.html and upload it via FTP to the work directory of your hosting server.
I have a website and I've been searching a lot for this question and can't find anything yet.
Anyone knows how to make links take you to another folder and show the html page without page in URL? Example:
I have a html page called service.html and its on folder /service. I want a link to take me there without displaying in the URL my html file like:
click me
And it takes you to the html file and shows your content without displaying the html name in the URL. just www.example/service/ :D
Calling the file index.html instead of service.html should work, if the website is currently hosted.
You can use the method #tasteslikejava mentioned, or you can create a .htaccess in the services directory and put in the following information:
DirectoryIndex service.html
Is that what you want?
link
How to link html pages in same or different folders?