Jul 25, 2008

Mod_rewrite - Apache helps with search engine indexing

Free Web Hosting, No Ads > CONTRIBUTE > The Internet > Google Services > SEO - Search Engine Optimization
Pages: 1, 2

free web hosting

Mod_rewrite - Apache helps with search engine indexing

prodigy
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

 

 

 


Reply

bjrn
QUOTE(prodigy @ Jan 1 2005, 03:50 AM)
Some good stuff about mod_rewrite


Just a quick question: can we use this on Trap17?

Reply

no9t9
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"

Reply

bjrn
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 smile.gif ), way more than many paid hosting plans.

I'll definitely have to set aside some big chunks of time for reading about mod_rewrite (and using it of course).

Reply

ashiezai
mod rewrite is a good thing to learn if u wan ur website to be well indexed by search engines smile.gif because they dun like (even cant read) URL with many parameters like =,&,$,% etc etc ..

currently im also using mod_rewrite to rewrite my website from .php to .html
as i know that SE cant read php that well smile.gif

.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 smile.gif

 

 

 


Reply

bjrn
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.

Reply

no9t9
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.

Reply

bjrn
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.

Reply

X3r0X
Good one Prodigy smile.gif Cred man, thats gonna make alota people happy!

Reply

no9t9
QUOTE
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.


umm... but that's not what I told you to do.. this is what I said (TWICE)... save the file from notepad as ".htaccess"... please actually try what I've said before telling me I'm wrong.

the comment made before that the .htaccess file "cannot be created in a windows system" is simply untrue. that's all i'm saying. Just because someone doesn't know how doesn't mean it cannot be done.

btw don't forget the quotes when saving the file from notepad (I also included these in both instances previously but never specifically mentioned them)

EDIT: If you want to do it without the quotes, you have to choose filetype "all files" otherwise it will tack on the default .txt extension

Reply

Latest Entries

prodigy
LoL no9t9 is a bit grumpy, i actually forgot to mention about using a PROGRAM to save your file as another file type, (I apologies for not reading your post no9t9, I must have eben pre-occupied) smile.gif.
Thankyou for summarising bjrn we were getting a little off topic. In this case no9t9 solution is the better procedure, being quicker.
However now we have finally discussed how to get/create a .htaccess file we should now create further additions of mod_rewrite which could be used. smile.gif

Reply

bjrn
Let's summaraize!

You can create a file called .htaccess with Windows, as long as you have some program (like notepad or similar) do it.

If you try to do it "by hand" by right-clicking somewhere and choosing New->Textfile and calling it .htaccess you'll get an error mesage.

Preferred solution: Do what no9t9 said, save a file using notepad (or similar).
Alternative solution: Do New->Textfile. Call it <something>.htaccess, upload it, rename it on the server.

In either case: Problem solved.

Reply

no9t9
did you even try what i suggested?

Reply

prodigy
No you are misunderstood no9t9, I simply mean that the majoity of peopel such as I cannot create files with "." at the beggining of the file, on windows xp sp2 i get the following error:
(X) You must type a file name.
So i was merely suggestiong a solution for users such as me who want a quick solution which works.
Their is other ways of avoiding this but I don't wanna go off the topic of mod_rewrite.

smile.gif

Reply

no9t9
QUOTE(prodigy @ Jan 14 2005, 04:45 AM)
Yes it is true that you can't create file names beggining with"." which is why you should create a file on your windows system like 1.htaccess then upload it via ftp or file manager. Then rename it on your non-windows server to .htaccess using your ftp manager or file manager (in cpanel).
Since the majority of servers are mostly linux/Unix (because they are cheaper) you probably won't have any problems.
Trap17 does allow mod_rewrite as we have apache installed.
*



so you're telling my I have a special copy of windows that allows me to save files beginning with a dot? whatever... i don't have to prove nothing. believe what you want. sheesh.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Pages: 1, 2
Similar Topics

Keywords : mod rewrite apache helps indexing

  1. Google Indexing Php Pages? - Is PHP a problem for google? (11)



Looking for mod, rewrite, apache, helps, search, engine, indexing

Searching Video's for mod, rewrite, apache, helps, search, engine, indexing
advertisement



Mod_rewrite - Apache helps with search engine indexing



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE