Joomla!
http://forum.joomla.org/

Using SEF without mod_rewrite
http://forum.joomla.org/viewtopic.php?f=46&t=1094
Page 1 of 5

Author:  Websmurf [ Tue Aug 23, 2005 9:03 am ]
Post subject:  Using SEF without mod_rewrite

In continuation of the topic on the former forum:

i think i've found a rather simple way to avoid the mod_rewrite ability in order to use SEF urls

Apache
1. Enable SEF in mambo configuration
2. do NOT rename the htaccess.txt
3. open /includes/sef.php and change this line: (~ line 217)
return $mosConfig_live_site."/".$string;
to
return $mosConfig_live_site."/index.php/".$string;

For this to work, you will have to make sure AccepPathInfo is set to on in the apache configuration.

IIS
for IIS or if you can't get the above working use :
return $mosConfig_live_site."/index.php?".$string;

it could also be needed to add this to your sef.php
Code:
$_SERVER['REQUEST_URI'] = (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME']);

// Append the query string if it exists and isn't null
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
  $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
}

(just above this line
if ($mosConfig_sef) {
)

this will enable SEF urls to work without mod_rewrite at all..
and create urls like this:
http://www.site.ext/index.php/content/view/9/34/
http://www.site.ext/index.php/content/view/10/35/
http://www.site.ext/index.php/component ... Itemid,78/

Author:  jema [ Tue Aug 23, 2005 9:11 am ]
Post subject:  Re: Using SEF without mod_rewrite

Interesting idea.

To explain a little how this works for the uninitiated. Normal sef urls need .htaccess which looks at the url, says ooh eh that does not really exists, and uses mod_rewrite to pass the url on to index.php.

This tweak means the url does actually exist as it has index.php already.

e.g.

http://www.tim-online.nl/index.php/content/view/9/34/

as opposed:

http://www.tim-online.nl/content/view/9/34/


hence it does not need mod_rewrite.

That being said, will search engines look and rank beyond the index.php in the url?

Author:  Websmurf [ Tue Aug 23, 2005 11:09 am ]
Post subject:  Re: Using SEF without mod_rewrite

yes actually.

Our main page has pagerank 7
"Over Tim" has pagerank 5
Forum has pagerank 5

Etc

Author:  alikon [ Tue Aug 23, 2005 12:27 pm ]
Post subject:  Re: Using SEF without mod_rewrite

Sorry for my ignorance,

my silly question is this:

for make component adhere the SEF specification  what i have to do in the code ?

Author:  Websmurf [ Tue Aug 23, 2005 12:39 pm ]
Post subject:  Re: Using SEF without mod_rewrite

do you mean making sef links in a component?

Code:
echo sefRelToAbs('index.php?option=com_mycomp&act=myact&task=mytask&Itemid=111');


or am i misunderstanding you?

Author:  alikon [ Tue Aug 23, 2005 12:47 pm ]
Post subject:  Re: Using SEF without mod_rewrite

yes, right,

another little question , we have to use sefRelToAbs() for any redirection such as form hyperlink tag and so on ...

Author:  Websmurf [ Tue Aug 23, 2005 12:53 pm ]
Post subject:  Re: Using SEF without mod_rewrite

any link users can click, can be spidered by search engines, so it would be wise to do that.
I don't think form tags etc would be usefull. Also popups (via index2.php) won't have to run through sefRelToAbs.

Author:  jema [ Tue Aug 23, 2005 12:56 pm ]
Post subject:  Re: Using SEF without mod_rewrite

Websmurf wrote:
yes actually.

Our main page has pagerank 7
"Over Tim" has pagerank 5
Forum has pagerank 5

Etc


To play devils advocate. Uless you can measure what would happen to page rank with and without SEF, it is only guessing.

Author:  Websmurf [ Tue Aug 23, 2005 1:06 pm ]
Post subject:  Re: Using SEF without mod_rewrite

very true, but pages get picked up.
i don't think it will make a difference. SEF friendly pages are just easier to index for google.

Author:  jema [ Tue Aug 23, 2005 1:12 pm ]
Post subject:  Re: Using SEF without mod_rewrite

Websmurf wrote:
very true, but pages get picked up.
i don't think it will make a difference. SEF friendly pages are just easier to index for google.


My understanding was that google was better than other search engines at reading non sef pages. Some search engines don't index paramaterised links. hence basic SEF like what we have here, made little difference on the google ranks but more difference with other engine.
For google you really need the "advanced" solutions. My downsizer site does very well with google and I put some of that down to SEF advance. The advanced solutions put keywords in the urls which does help rank.

Author:  Websmurf [ Tue Aug 23, 2005 1:21 pm ]
Post subject:  Re: Using SEF without mod_rewrite

Quote:
My understanding was that google was better than other search engines at reading non sef pages. Some search engines don't index paramaterised links.

that's another thing that's true :)

yes, SEF advanced is something i will definately buy for future sites. Works very nice and isn't that expensive at all.

Author:  pointri [ Wed Aug 24, 2005 8:26 pm ]
Post subject:  Re: Using SEF without mod_rewrite

Happy to see this thread recesuitated.  This hack was a lifesaver, well, until we migrated to an Apache server with mod_rewrite.  Thanks again websmurf.

Author:  de [ Wed Aug 24, 2005 8:46 pm ]
Post subject:  Re: Using SEF without mod_rewrite

I thought I throw in another possibility which should work with Apache interpreting the .htaccess file (but without mod_rewrite):
Create the file .htaccess and make the following the only line:
Code:
ErrorDocument 404 /index.php

Then if you are using 404 SEF no further action should be required... for others which probably not set the status code you may want to add the following to your index.php (next to the other header function calls you will find around line 200):
Code:
header('HTTP/1.0 200 OK');


(this is describes the replacement for the renaming of the htaccess.txt... all other steps will remain the same... like enabling SEF or optionally installing an addition SEF component)

Author:  joomlasolutions_JB [ Fri Aug 26, 2005 1:10 pm ]
Post subject:  Re: Using SEF without mod_rewrite

websmurf--

Thanks for you help getting SEF working on IIS


:)

Author:  Websmurf [ Fri Aug 26, 2005 1:34 pm ]
Post subject:  Re: Using SEF without mod_rewrite

not a problem :)

Author:  Guardian [ Sat Aug 27, 2005 1:57 pm ]
Post subject:  Re: Using SEF without mod_rewrite

Websmurf wrote:


would it be possible to achieve something like:
http://www.mysite.com/index.php/section ... Alias.html ?

i mean the only difference with a mod_rewrite enabled SEF facility would be the "index.php" inserted but the end of the url would look the same

thx for any hint
Gregory

Author:  zimmik [ Sun Aug 28, 2005 3:00 pm ]
Post subject:  Re: Using SEF without mod_rewrite

Thax, just what i needed.

Author:  Websmurf [ Mon Aug 29, 2005 7:52 am ]
Post subject:  Re: Using SEF without mod_rewrite

Guardian wrote:
Websmurf wrote:


would it be possible to achieve something like:
http://www.mysite.com/index.php/section ... Alias.html ?

i mean the only difference with a mod_rewrite enabled SEF facility would be the "index.php" inserted but the end of the url would look the same

thx for any hint
Gregory



Yes, With the open source solutions, there should be a simular line in the files (components/com_sef/sef.php)

If you want to use sef advanced, you'll have to ask Emir to make the modification

Author:  Guardian [ Mon Aug 29, 2005 8:02 am ]
Post subject:  Re: Using SEF without mod_rewrite

I tried 404SEF on another web account that has mod_rewrite enabled and it worked just fine.

I hope I'll succeed in using it without mod_rewrite performing the modification you described.

Gregory

Author:  stuclark [ Tue Aug 30, 2005 8:44 pm ]
Post subject:  Re: Using SEF without mod_rewrite

I've just been playing with this on my IIS server - it turns out that (so long as you've got index.php selected as a default document in IIS) you don't even need the index.php in the SEF'd URL.

However, you DO need the ? and I have found that you also need a trailing /

So, the complete URL produced would be http://www.domain.com/?/content/view/1/2/

This can be seen in action at http://www.sendosmartphones.com

Now my question is - would a search engine prefer .../?/... or .../index.php?/...

Author:  Websmurf [ Wed Aug 31, 2005 7:30 am ]
Post subject:  Re: Using SEF without mod_rewrite

I don't know.

My preference would be /index.php?/

Author:  stuclark [ Wed Aug 31, 2005 8:37 am ]
Post subject:  Re: Using SEF without mod_rewrite

Having played with this a little more - you need to use index?/ as otherwise things like SMF can't link to themselves properly.

Front-end editing is also borked - sef.php doesn't correctly identify those links as already having a /index.php? statement, so adds another. This results in broken URLs which look like .../index.php?/index.php?component=...

Seeing as sef breaks when I add the first few lines into sef.php - can anyone think of a way around this on IIS?

Author:  eosguy [ Fri Sep 02, 2005 1:35 pm ]
Post subject:  Re: Using SEF without mod_rewrite

Hi... I've done exactly what was detailed here, and the SEF worked on all pages except on 'projects' on my site: http://www.motion-ds.com/design/index.php

Any ideas why? Thanks for looking.


I'm not sure if it's appropriate to ask this question here - how do I improve my page ranking besides using SEF? My site is basically running 3 different site scripts, Mambo/Joomla!, phpBB and Gallery. So far keyword search in Altavista returned good results, while Google and Yahoo! returns nothing at all. :(

Author:  eosguy [ Sun Sep 04, 2005 5:19 am ]
Post subject:  Re: Using SEF without mod_rewrite

Kindly ignore my previous post. I managed to get a proper link after changing the category/link.

Author:  drewg [ Mon Sep 19, 2005 7:49 am ]
Post subject:  Re: Using SEF without mod_rewrite

Hmm, great help, works for my main site, but maybe this is just me doing it wrong, I have an addon domain.. Anyway when trying to do it for the addon domain, I click on the link to my static content, and it goes there, but it just shows the homepage content.. Wierd, I'll add a seperate account for it and try, but yeh, a bit wierd.

Author:  stingrey [ Mon Sep 19, 2005 12:19 pm ]
Post subject:  Re: Using SEF without mod_rewrite

Only stumbled upon this page now.


Very interesting to say the least

Author:  bluesaze [ Mon Sep 19, 2005 2:23 pm ]
Post subject:  Re: Using SEF without mod_rewrite

I had put in the wish list i guess you missed it ...... maybe we can have a inbuilt option for the windows users usign IIS
stingrey wrote:
Very interesting to say the least

Author:  Websmurf [ Mon Sep 19, 2005 2:26 pm ]
Post subject:  Re: Using SEF without mod_rewrite

stingrey wrote:
Only stumbled upon this page now.


Very interesting to say the least

it's been around for a while though :P

You could build it into mambo very easily. Some sort of mod_rewrite/basic check

Author:  stingrey [ Mon Sep 19, 2005 2:36 pm ]
Post subject:  Re: Using SEF without mod_rewrite

Websmurf wrote:
You could build it into mambo very easily. Some sort of mod_rewrite/basic check

Yes it does raise some interesting possibilities

Author:  Thiago [ Tue Sep 20, 2005 5:14 pm ]
Post subject:  Re: Using SEF without mod_rewrite

I just tried this on my website running on IIS, works great!

Thx,

Thiago

Page 1 of 5 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/