|
|
|
|
![]() ![]() |
| prodigy |
Jan 1 2005, 01:50 AM
Post
#1
|
|
Guests |
The Apache mod_rewrite module helps with search engine indexing for dynamic urls considerably. Living proof of this is these forums which we are looking at now. If your usig languages such as php and asp it may be necessary to make your urls less dynamic, well they won't really be less dynamic in reality but to the eye urls willseem more simple. Mod_rewrite has the ability to rewrite urls on the fly, their are many ways optimise your site using mod_rewrite, heres a basic method i use on my site:
Using .htaccess: Options +FollowSymLinks RewriteEngine on RewriteRule index-home(.*)\.html$ /index.html?act=home$1 RewriteRule index-plans(.*)\.html$ /index.html?act=plans$1 RewriteRule index-support(.*)\.html$ /index.html?act=support$1 RewriteRule index-contact(.*)\.html$ /index.html?act=contact$1 RewriteRule index-about(.*)\.html$ /index.html?act=about$1 Using the apache module I have rewritten the default index.html?act=home url of mine to index-home.html. Which gives a mask for better search engine indexing as most search engines prefer simple endings. Of course my case is a very simple method and I don't even use hashes or anything in my custom made pages, but for the more advanced cases webmasters could find mod_rewrite really usefull. Also some of you may ask why or how I have used the get function (php) with html, well I havn't actually used it with html, again I have utilised apache handlers (in your cpanel) to read php within html files. Heres a quick .htaccess example of this: AuthName www.shothost.com AuthUserFile /home/shothost/public_html/_vti_pvt/service.pwd AuthGroupFile /home/shothost/public_html/_vti_pvt/service.grp AddHandler application/x-httpd-php .htm AddHandler application/x-httpd-php .html Hoep I have helped some of you guys out there trying to improve your search engine performance. FOor more information visit: Apache |
|
|
|
Jan 10 2005, 09:52 AM
Post
#2
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 378 Joined: 8-January 05 Member No.: 3,174 |
QUOTE(prodigy @ Jan 1 2005, 03:50 AM) Some good stuff about mod_rewrite Just a quick question: can we use this on Trap17? |
|
|
|
Jan 10 2005, 01:29 PM
Post
#3
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 773 Joined: 4-November 04 Member No.: 2,118 |
yes. trap17 has this "feature" if you look in your website directory there should be a file called .htaccess Edit this file with the mods you want. if the file isn't there, you can just create the file with notepad and save it with the name ".htaccess"
|
|
|
|
Jan 10 2005, 02:35 PM
Post
#4
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 378 Joined: 8-January 05 Member No.: 3,174 |
QUOTE(no9t9 @ Jan 10 2005, 03:29 PM) yes. trap17 has this "feature" if you look in your website directory there should be a file called .htaccess Edit this file with the mods you want. if the file isn't there, you can just create the file with notepad and save it with the name ".htaccess" Keen. My list of "Things I want to try out" is starting to get very long now though. Trap17 has sooo many features (I'm not complaining of course I'll definitely have to set aside some big chunks of time for reading about mod_rewrite (and using it of course). |
|
|
|
Jan 10 2005, 03:11 PM
Post
#5
|
|
|
King of My WOrld ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 482 Joined: 11-October 04 Member No.: 1,665 |
mod rewrite is a good thing to learn if u wan ur website to be well indexed by search engines
currently im also using mod_rewrite to rewrite my website from .php to .html as i know that SE cant read php that well .htaccess cant be created windows system .. i think this is because windows doesnt recognize filename which starts which "." The way to create a .htaccess file is simply create it using notepad and name is anything u like .. then upload to ur homepage server and rename it to .htaccess .. that will do the job ... ofcos u can also create it directly on the cpanel's filemanager |
|
|
|
Jan 10 2005, 07:38 PM
Post
#6
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 378 Joined: 8-January 05 Member No.: 3,174 |
QUOTE(ashiezai @ Jan 10 2005, 05:11 PM) .htaccess cant be created windows system .. i think this is because windows doesnt recognize filename which starts which "." Hey, that's really weird. I hadn't noticed that before. It's not like windows can't handle files starting with a full stop (I'm fairly certain of). I think I've had apps that made such files. Probably just some stupid function that gets called when you (re)name files that interprets everything after the first '.' as the extension. |
|
|
|
Jan 11 2005, 04:30 AM
Post
#7
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 773 Joined: 4-November 04 Member No.: 2,118 |
what do you mean .htaccess can't be created in a windows system??? what windows system are you using? simply save the file from notepad as ".htaccess" It works.
|
|
|
|
Jan 11 2005, 09:13 AM
Post
#8
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 378 Joined: 8-January 05 Member No.: 3,174 |
QUOTE(no9t9 @ Jan 11 2005, 06:30 AM) what do you mean .htaccess can't be created in a windows system??? what windows system are you using? simply save the file from notepad as ".htaccess" It works. Try this on your desktop. Right klick > New > textfile. Write '.htaccess' as the name, hit enter, or klick somewhere on the desktop. You'll get an error message. As I said, it's probably some stupid function that gets called when you (re)name a file. Apps writing to files aren't restricted by it. It probably went something like this: Microsoft boss person: Hey, dev guy. Write a function for renaming files Dev guy: Okay DG thinks that the easy thing would be to set everything before the first full stop as name and everything after it as the extension (since Windows has to warn if the user changed the extension to something weird). DG writes the function. The result is that because there is no text in front of the first full stop, Windows thinks you haven't written a name for the file. And so it gives an error message. Instead the dev guy should of course have done something else. Like allowing any name with at least one character. Or checking on the last full stop instead. Edit: It happens on both newer (XP) and older (98) Win systems. |
|
|
|
Jan 11 2005, 10:40 AM
Post
#9
|
|
|
^^ Thats me ^^ ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 528 Joined: 14-July 04 Member No.: 90 |
Good one Prodigy
|
|
|
|