This is all you have to do in order to be able to view files in a directory from any browser. If you try to go to a folder on your server with a browser and get a Forbidden, 404 or 403 error then this is the solution you need. If you go to the folder in a browser and see a webpage instead of files, then you just need to rename the index.html or index.php file to some other name besides "index" because most servers are set up to show index.php or index.html by default if no page is named in the address bar. However if you have already made sure there is no index file in your folder and you still can't view files because it says Forbidden or some similar error, then do this:
Make sure there is no .htaccess file in the folder to start with. If there is, add the line below to that file instead of uploading a new file.
Otherwise, open up your favorite notebook app that you would use for coding and start a new file. Copy and Paste the following into an empty file:
Save the file as .htaccess being sure that it saved with the period before the name. Then upload the new .htaccess file to the directory
This week, I decided to tackle a Joomla job. The client was using Joomla 1.5 and the K2 extention, so that is rather important for this article to make sense completely, but it is similar to so pretty URLs without K2.
Setting up Permalinks in Joomla 1.5 and K2
This tutorial if about how to create nice looking links to your Joomla pages or articles. Here is how. I did this with hidden menus because I didn't want to add my Menu items to the main menu, but you can choose to add yours to the main menu if you want to see them in the navigation bar of your site.
- go to the Joomla admin and hover over the "menus" button in the main admin menu. Then select the menu item you want to add your menu to or select menu manager to create a new one.
- For the "Menu Item Type" select "Item" to create a menu item linking directly to an item in K2.
- In the resulting form, enter a title that will allow you to recognize the function of this menu item. I made a menu for service links, so I named my menu item, "Service Links".
- In the "Alias" field you put what you want to be in the url as the directory name part in the path to your page. So my page was called "PHP" and my goal was to make a link that looks like "http://www.example.com/services/php", so I entered "services" as the Alias.
- Skip over the "Link" field as it will fill out itself and go to the "Display In" field and select the menu item you want your link to appear under or pick one that is not shown publicly if you don't want to put your link in the actual navigation bar of the site.
- Go to the "Parent Item" field and select the item you want preceding the link. At this point, you will probably just have the "Top" option, which is perfect for what we are doing. Leave "Top" selected. Leave the rest of the defaults set in the left column of the page.
- In the right column, at the top, where it says "Parameters (Basic)" go to the "" field and select any item for this field as it is not important since we are creating a dummy item at this point just to get the directory parameter of our URL. CLick to save your menu.
Second, create a menu item for each page in "services" so here is how I did my PHP services page:
- Go back to the main admin navigation menu and hover over "Menus" again and this time, select the menu name you choose to put your menu under in the steps above. You will see the menu item you created first, which was "Service Links" in my case, on the resulting page.
- Click on the big green "New" button at the top of the page to add a new Menu item. This time we are going to make a submenu of the "Service Links". Remember that service links has an alias of services to create the directory part as explained above so now we create the php part which is effectively the page name.
- Under "Select Menu Type", select "K2" then "Item".
- in the resulting page, enter a title that is the same as your article or page title, so I entered "PHP" as it is a page about my PHP services.
- Next, in the "Alias" field, I entered "php", all lowecase for a search engine friendly URL.
- In the "Display In" field, I select the same menu item I selected when creating the first part of the link way above at the top of this page.
- Then, I select "Service Links" as the parent menu so it will have the services/php effect I want on my link.
- That's it for settings in the left side of the page, now go to the right column at the top of the page and by where it says "Parameters(Basic)", select the actual article/page name you would have created before this tutorial(or create one real quick if you have not done so already). Then click the save icon at the top of the page to save your new link. I now have a link to services/php that is nice and search engine friendly!
I know it's a lot harder to do this in Joomla and much easier to do in WordPress, so I remain a larger fan of WordPress still!