Current location: Hot Scripts Forums » Programming Languages » PHP » URL Rewrite without mod_rewrite???


URL Rewrite without mod_rewrite???

Reply
  #1 (permalink)  
Old 09-21-05, 06:11 AM
enchen's Avatar
enchen enchen is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Question URL Rewrite without mod_rewrite???

Hi does anyone know of a method for rewriting a URL without using Apache's mod_rewrite.

I would like to change my URL's in the browser's address bar from:

domain.com/index.php?choice=something&variable1=value1

Sometimes also:

index.php?choice=something&variable1=value1&variab le2=value2

To the more friendly looking:

domain.com/something/value1.html

Or even better:

domain.com/something/title_of_value1.html

I thought maybe this could be done by creating a rewrite function in the php header of the index file or similar...

So when somebody calls for domain.com/something/title_of_value1.html , this function would read the URL and decode it to the rest of the page in order for it to collect the correct values from mySQL etc.

Any help is greatly appreciated!!!
__________________
Today is tomorrow, yesterday...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-21-05, 01:34 PM
nekeno12 nekeno12 is offline
Wannabe Coder
 
Join Date: May 2004
Location: CO
Posts: 214
Thanks: 0
Thanked 0 Times in 0 Posts
No. It has to be interpreted though mod_rewrite.

The problem is, when you try and request domain.com/something/title_of_value1.html without using mod_rewrite, apache automatically sends back a 404 error.

Now, you could have your 404 page be a 404.php page, that interprets the url and parses what it needs to, but that's not really URL friend or search engine friendly, because a 404 error still gets sent back.

So, search engines will never index the page with this method, making it totally useless.

Mod_rewrite is not that hard. You can use it in the .htaccess file in the same directory as the php file.

Here's a rule generator:
http://www.webmaster-toolkit.com/mod...enerator.shtml
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 09-22-05, 03:52 AM
enchen's Avatar
enchen enchen is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Angry

The problem is that my host hasn't enabled mod_rewrite on their server, which leaves me without any options I suppose...
__________________
Today is tomorrow, yesterday...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 09-22-05, 04:04 AM
arstanj's Avatar
arstanj arstanj is offline
Newbie Coder
 
Join Date: Sep 2005
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by enchen
The problem is that my host hasn't enabled mod_rewrite on their server, which leaves me without any options I suppose...
I'd use .htaccess file to do that. Go do some googling. I'm sure you'll find a lot of answers.

Happy coding!
__________________
Happy coding!

----------------------------
http://www.jusupov.com - Computer Technology Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 09-22-05, 06:18 AM
enchen's Avatar
enchen enchen is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb

Quote:
Originally Posted by enchen
The problem is that my host hasn't enabled mod_rewrite on their server, which leaves me without any options I suppose...
Found this great tutorial which seams to solve my problem

PHP alternative to mod_rewrite

My only concern is that the search engines might get a redirect call 30*somthing* or a 404 when visiting the URL's.
Anyone got a clue if I should be worried or not
__________________
Today is tomorrow, yesterday...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 09-22-05, 11:39 AM
nekeno12 nekeno12 is offline
Wannabe Coder
 
Join Date: May 2004
Location: CO
Posts: 214
Thanks: 0
Thanked 0 Times in 0 Posts
Yes. We tried the same method and I described it above. The search engines will see in the header response that it's not a 200OK. They won't cache or index that page.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 09-22-05, 11:40 AM
nekeno12 nekeno12 is offline
Wannabe Coder
 
Join Date: May 2004
Location: CO
Posts: 214
Thanks: 0
Thanked 0 Times in 0 Posts
If your host doesn't have mod_rewrite. Just try and limit your query stings in PHP. We use one PHP $_GET variable on one of our sites and we have over 1000 pages indexed in Google.

http://www.site.com/?content=Foo%20Bar

This url does index well in google and the others
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 09-22-05, 11:43 AM
enchen's Avatar
enchen enchen is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb

Thanks for all your feedback....

I'll try to shorten the string and hope they'll add the Apache module not to long into the future...

Anyway, I checked the access.log in Apache and it seams that when running the alternative method described in the tutorial above you will get a 200 OK
return from the server. At least on a Apache 2.0.xx server, I've not tested it
on 1.3.xx yet. Any feedback on that would be appreciated

Code:
127.0.0.1 - - [22/Sep/2005:16:29:11 +0200] "GET /website/en/index/apartments/page/12 HTTP/1.1" 200 20821
__________________
Today is tomorrow, yesterday...

Last edited by enchen; 09-22-05 at 12:08 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help: Html script- url linking nyjumpman23 HTML/XHTML/XML 5 09-28-05 10:19 PM
URL Rederecting with PHP? Cyder PHP 1 08-15-05 10:24 AM
The Reasons Why do you Need URL Rewriting MODULE to Enchance your Web? handry PHP 11 08-05-05 08:32 AM
Simple Code to go to specific URL maxo C/C++ 0 02-10-05 12:53 PM
iframe linking not working under url masking willNoClue HTML/XHTML/XML 1 08-02-04 11:34 AM


All times are GMT -5. The time now is 07:21 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.