Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-06-2008, 12:38 PM   PM User | #1
ess
Regular Coder

 
Join Date: Oct 2006
Location: United Kingdom
Posts: 865
Thanks: 7
Thanked 29 Times in 28 Posts
ess will become famous soon enough
Pretty URLs without Mod_ReWrite

I was wondering if there is a way to create pretty or search engine friendly urls when mod_rewrite is not installed on a given server.

Any suggestion or pointer to an article would be much appreciated it.

Thanks
~E
ess is offline   Reply With Quote
Old 09-06-2008, 12:55 PM   PM User | #2
PHP6
Regular Coder

 
PHP6's Avatar
 
Join Date: Aug 2008
Location: Czech Republic
Posts: 234
Thanks: 17
Thanked 34 Times in 33 Posts
PHP6 is on a distinguished road
Quote:
Originally Posted by ess View Post
I was wondering if there is a way to create pretty or search engine friendly urls when mod_rewrite is not installed on a given server...
To be honest that is too old term 'search engine friendly urls'. Most famous search engines like: google, yahoo, msn could understand everything after '?' char in the url and treat them as different ones. So, nowadays there are no much reasons to make 'urls nice', even in past that was just 1-2% of all SEO

p.s. as an example you can take our forum codingforums.com, check the amount of cached pages... about 383,000
PHP6 is offline   Reply With Quote
Old 09-06-2008, 02:48 PM   PM User | #3
ess
Regular Coder

 
Join Date: Oct 2006
Location: United Kingdom
Posts: 865
Thanks: 7
Thanked 29 Times in 28 Posts
ess will become famous soon enough
Quote:
Originally Posted by PHP6 View Post
Most famous search engines like: google, yahoo, msn could understand everything after '?' char in the url and treat them as different ones. So, nowadays there are no much reasons to make 'urls nice', even in past that was just 1-2% of all SEO
That doesn't answer my question though.

I didn't ask how search engines go about listing or indexing web pages. I asked it is possible to create pretty urls or search engine friendly urls without using mod_rewrite.
ess is offline   Reply With Quote
Old 09-06-2008, 03:47 PM   PM User | #4
PHP6
Regular Coder

 
PHP6's Avatar
 
Join Date: Aug 2008
Location: Czech Republic
Posts: 234
Thanks: 17
Thanked 34 Times in 33 Posts
PHP6 is on a distinguished road
Quote:
Originally Posted by ess View Post
That doesn't answer my question though.

I didn't ask how search engines go about listing or indexing web pages. I asked it is possible to create pretty urls or search engine friendly urls without using mod_rewrite.
It depends what do you call nice if you need URL like that:

Quote:
_http://example.com/somepath/var1/var2/var3/index.htm
when you need mod_rewrite and there is not other way to solve it (some script/program should handle that not existed URL... of cause you can try to catch it on 404 and do some redirects based on referrer but in that case you will have lots of errors in log file ). But if the following URL is nice too for you:

Quote:
_http://example.com/somepath/index.php/var1/var2/var3/index.htm
then you can do it even without mod_rewrite.

p.s. that is strange that you cannot find the similarity between my answer and you question, they are 90% dependent on each other. Of cause it was not a direct answer but it has the hint: 'there is not reason of making such nice URLs, it will be just waisting of you time' but it is up to you I am almost two years in SEO business and I know several ways how to bring almost any website to the google top. I wanted to share some information with you but if you do not want it is better for me

Last edited by PHP6; 09-06-2008 at 03:58 PM..
PHP6 is offline   Reply With Quote
Old 09-06-2008, 04:08 PM   PM User | #5
ess
Regular Coder

 
Join Date: Oct 2006
Location: United Kingdom
Posts: 865
Thanks: 7
Thanked 29 Times in 28 Posts
ess will become famous soon enough
PHP6 well done for doing well in the SEO business. and NO, your previous answer does NOT get anywhere near 0.00001% to my question....and no, I am not going to talk about search engines or what you know about the SEO business.

I am asking how to rewrite urls without using mod_rewrite. I used the term SEO as many people seem to associate it with writing urls such as the following, which is what I want to achieve without the use of mod_rewrite.

Code:
http://example.com/about
http://example.com/about/history
http://example.com/contact
or

Code:
http://example.com/index.php/about
http://example.com/index.php/about/history
http://example.com/index.php/contact
ess is offline   Reply With Quote
Old 09-06-2008, 04:49 PM   PM User | #6
PHP6
Regular Coder

 
PHP6's Avatar
 
Join Date: Aug 2008
Location: Czech Republic
Posts: 234
Thanks: 17
Thanked 34 Times in 33 Posts
PHP6 is on a distinguished road
Ok, feel free to think that my previous message was not answering your question... I am not going to argue regarding that subject, it will be wasting of your and my time.

The more important is that now we know what are you looking for and that you will do those nice URLs in spite of everything... Since you are OK with such URLs:

Quote:
_http://example.com/index.php/about/history
you will need to create index.php script which will parse the URL and redirects the user to required URL:

PHP Code:
<?php
  
echo $_SERVER['REQUEST_URI'];
?>
the request was:

Quote:
_http://example.com/test.php/somepath/var1/var2/index.htm
the output was:

Quote:
/test.php/somepath/var1/var2/index.htm

Last edited by PHP6; 09-06-2008 at 06:05 PM..
PHP6 is offline   Reply With Quote
Old 09-07-2008, 07:17 AM   PM User | #7
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Only way I can think of is to modify your error404 page to contain some php to check the url entered, then split the url up and redirect/include the page you want to show. But, to modify your 404 page (location to your new php 404 page), you need to access your htaccess file :s So, thinking about that, scrap that idea.

I can't think of a way
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Users who have thanked Nightfire for this post:
ess (09-07-2008)
Old 09-07-2008, 05:55 PM   PM User | #8
ess
Regular Coder

 
Join Date: Oct 2006
Location: United Kingdom
Posts: 865
Thanks: 7
Thanked 29 Times in 28 Posts
ess will become famous soon enough
Thanks Nightfire

That was the only solution I could come up with as well....but wondered if any one has a different approach to utilizing ErrorDocs

Cheers
~E
ess is offline   Reply With Quote
Old 09-07-2008, 06:30 PM   PM User | #9
mlacy03
New to the CF scene

 
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 1 Time in 1 Post
mlacy03 is an unknown quantity at this point
An idea would be to take something like this:
Quote:
/test.php/somepath/var1/var2/index.htm
and either explode it based on a particular number of psuedo-directories after the PHP script.
Example (I can't remember the actual function to make this happen in PHP, however):
PHP Code:
//chop the $inputstring into an array delimited by "/"
//reminds me of a CSV file

$inputstring "/test.php/somepath/var1/var2/index.htm";
$path $inputstring[1];
$var1 $inputstring[2];
//and so on 
mlacy03 is offline   Reply With Quote
Users who have thanked mlacy03 for this post:
ess (09-08-2008)
Old 09-07-2008, 07:45 PM   PM User | #10
jlhaslip
Regular Coder

 
Join Date: Feb 2007
Location: Canada
Posts: 924
Thanks: 10
Thanked 56 Times in 55 Posts
jlhaslip is on a distinguished road
why re-invent the wheel here... mod-rewrite works fine.

If the Hosting Server you are using won't allow the use of mod-rewrite, get another host.
jlhaslip is offline   Reply With Quote
Users who have thanked jlhaslip for this post:
ess (09-08-2008)
Old 09-08-2008, 10:48 AM   PM User | #11
PHP6
Regular Coder

 
PHP6's Avatar
 
Join Date: Aug 2008
Location: Czech Republic
Posts: 234
Thanks: 17
Thanked 34 Times in 33 Posts
PHP6 is on a distinguished road
Quote:
Originally Posted by ess View Post
Thanks Nightfire

That was the only solution I could come up with as well....but wondered if any one has a different approach to utilizing ErrorDocs

Cheers
That’s my first off topic, here is prove that you do not read my posts Just couple of post before I have gave you that option but you do not pay attention to it... later, after 4 post you came to conclusion that Nightfire gave you good advice mega LOL

Quote:
09-06-2008 03:47 PM when you need mod_rewrite and there is not other way to solve it (some script/program should handle that not existed URL... of cause you can try to catch it on 404 and do some redirects based on referrer but in that case you will have lots of errors in log file ).
Please take in consideration that next time I will not spend even one second on your question... you are so rude that you even do not say thank you for my help (I gave you two different solutions including 404)...

Last edited by PHP6; 09-08-2008 at 10:54 AM..
PHP6 is offline   Reply With Quote
Old 09-08-2008, 11:00 AM   PM User | #12
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Hi PHP6,
sorry for being off topic again, but "Pretty URLs" are not pretty to the search engines only, but to the users of the site too!

Code:
mysite.com/10/mypage => mysite.com/index.php?category=10&file=mypage
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Users who have thanked abduraooft for this post:
ess (09-08-2008)
Old 09-08-2008, 11:08 AM   PM User | #13
PHP6
Regular Coder

 
PHP6's Avatar
 
Join Date: Aug 2008
Location: Czech Republic
Posts: 234
Thanks: 17
Thanked 34 Times in 33 Posts
PHP6 is on a distinguished road
Quote:
Originally Posted by abduraooft View Post
Hi PHP6,
sorry for being off topic again, but "Pretty URLs" are not pretty to the search engines only, but to the users of the site too!

Code:
mysite.com/10/mypage => mysite.com/index.php?category=10&file=mypage
The topic starter mention term 'search engine friendly url' so I have explained (shared private information which costs money in SEO business) in first replay that this is old fashioned and outdated term... later he asks me that he wants to create that friendly urls anyway so I gave him two possible solutions (including 404 which he thanked) but I even do not get 'thank you' back. The little reward which users get here...

As for the user friendly urls. That is very disputable question... since there is just few users who will type that url by heart:

http://www.codingforums.com/148306/showthread/ => http://www.codingforums.com/showthread.php?t=148306

that is the most simple version, while in most cases url has more than one parameter and with random numbers, which could just 1% of all users remember. Most of them user bookmarks so in that case that user friendly urls are useless too

Of cause I have forget to mention that user friendly urls uses lots of server's resources... that is why mod_rewrite is disabled on 99% shared hosting

Last edited by PHP6; 09-08-2008 at 02:29 PM..
PHP6 is offline   Reply With Quote
Old 09-08-2008, 12:14 PM   PM User | #14
djm0219
Senior Coder

 
djm0219's Avatar
 
Join Date: Aug 2003
Location: Wake Forest, North Carolina
Posts: 1,227
Thanks: 2
Thanked 189 Times in 187 Posts
djm0219 is on a distinguished road
Quote:
Originally Posted by PHP6 View Post
Of cause I have forget to mention that user friendly urls uses lots of server's resources... that is why mod_rewrite is disabled on 99% shared hosting
That's not really true. The amount of resources used for rewriting URLs is tiny unless you have a really huge set of rewrite rules (which is not the normal case). I don't know where you heard that rewrite is disabled on 99% of shared hosting but that also is not true at all.
__________________
Dave .... HostMonster for all of your hosting needs
djm0219 is offline   Reply With Quote
Users who have thanked djm0219 for this post:
ess (09-08-2008)
Old 09-08-2008, 02:25 PM   PM User | #15
PHP6
Regular Coder

 
PHP6's Avatar
 
Join Date: Aug 2008
Location: Czech Republic
Posts: 234
Thanks: 17
Thanked 34 Times in 33 Posts
PHP6 is on a distinguished road
Quote:
Originally Posted by djm0219 View Post
That's not really true. The amount of resources used for rewriting URLs is tiny unless you have a really huge set of rewrite rules (which is not the normal case). I don't know where you heard that rewrite is disabled on 99% of shared hosting but that also is not true at all.
Thank for your input in discussion now that topics looks very interesting. I am not so good in server’s administration but in past I had such experience: I have couple of my own dedicated servers where mod_rewrite is enabled and some for just static data without mod_rewrite... (it is good for graphics, since the traffic costs are minimum).

Once I have decided to move one of my websites (which needs mod_rewrite) to that static server and I have asked admin to enable mod_rewrite... he said that it is impossible since it will make high load of CPU. Of cause we are speaking about servers which has at list 30-50 million hits per day... for example codingforum.com should have up to 100 million hits per day, if they will use mod_rewrite in URL that will use lots of their server's resources.

p.s. As for the shared hostings, probably they have no such experience before even my friend's forum was continuously closed, for the reason of high resources usage... websites with 10K unique visitors per day is ok but if you will have 100K that is a big problem I have such experience many times when you buy hosting and they promise you that you will not have any restrictions... but as soon as you mod_rewrite rules will cause high load they will block your account

Last edited by PHP6; 09-08-2008 at 02:30 PM..
PHP6 is offline   Reply With Quote
Reply

Bookmarks

Tags
apache, mod_rewrite, php, seo

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:12 AM.


Advertisement
Log in to turn off these ads.