Jump to content
xisto Community
Sign in to follow this  
iGuest

Mod_rewrite Apache helps with search engine indexing

Recommended Posts

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 http://www.sedoparking.com/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

Share this post


Link to post
Share on other sites

yes. Xisto 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"

Share this post


Link to post
Share on other sites

yes. Xisto 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"

<{POST_SNAPBACK}>

Keen.

 

My list of "Things I want to try out" is starting to get very long now though. Xisto has sooo many features (I'm not complaining of course :rolleyes: ), 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).

Share this post


Link to post
Share on other sites

mod rewrite is a good thing to learn if u wan ur website to be well indexed by search engines :rolleyes: 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 :).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 :)

Share this post


Link to post
Share on other sites

.htaccess cant be created windows system .. i think this is because windows doesnt recognize filename which starts which "."

<{POST_SNAPBACK}>

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.

Share this post


Link to post
Share on other sites

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.

<{POST_SNAPBACK}>

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

i don't konw if it works, but Invision Board (1.3.1) has an add-on script for you called "show.php"
if you go to: http://forums.xisto.com/no_longer_exists/
it includes: http://forums.xisto.com/no_longer_exists/

it's got the same result of using mod_rewrite and i think it should work with Windows.

here's a modification I did from that file to be more useful for me:

<?php

$before = "index.php";

$after = "";
$control = 0;

foreach (explode("/",$_SERVER['PHP_SELF']) as $part) {

if ($part != "") {

if ($part == "ver.php") {
$zero = true;
}
elseif ($zero == true) {
$before .= $part.'?';
}
else {

if ($control==0) {
$after .= $part.'=';
$control++;
}
else {
$after .= $part.'&';
$control = 0;
}

}
}

}

include_once ($before.$after);

exit();

?>

Share this post


Link to post
Share on other sites

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.

<{POST_SNAPBACK}>

And I mentioned (re)naming files, it doesn't take an incredible amount of thought to come to the conclusion that it might not be naming and renaming through saving with notepad, no? No need to get angry about it.

Share this post


Link to post
Share on other sites

no need to get angry about it... i was replying to the comment where it was stated that the file COULD NOT BE CREATED IN A WINDOWS SYSTEM. I said it can. This was the point of the post.So when you quote my point and tell me to try renaming the file I am logically assuming that you are replying to MY POINT. Am I supposed to KNOW that you aren't even talking about my point after quoting it? why even bother quoting me if you weren't addressing my point? Please stop trying to back peddle cause it aint working.It doesn't take an incredible amount of thought to make an intelligent response to a post... but it does take SOME thought.

Share this post


Link to post
Share on other sites

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.Xisto does allow mod_rewrite as we have apache installed.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.