You are here: Re: URL Rewriting « PHP Programming Language « IT news, forums, messages
Re: URL Rewriting

Posted by feed_sheep on 10/27/03 11:33

I'm confused. I have set the following

RewriteEngine on
RewriteRule ^alumni/?$ index.php?content=alumni

When I type www.site.com/alumni, it loads the index.php?content=alumni
But when I type www.site.com/alumni/ it looks in the real folder on the site
for an index.php (and doesn't find one). Plus, it sets all URLs in the page
to be www.site.com/alumni/whatever.php

What am I doing wrong?

Thanks,

David


"Ed" <paperhat@zoominternet.net> wrote in message
news:1131758972_317@spool6-east.superfeed.net...
> go@thescriptsmailer.com wrote:
>> Can someone please tell me what URL rewriting is? I don't understand . .
>> . a client is asking me to rewrite his URLs.
>>
>
> Hi there,
>
> What your client is probably referring to is Apache's mod_rewrite module.
> It is often used to rewrite 'static' URLs to dynamic ones, which has
> several advantages; URLs are easier to remember, it makes pages more
> search engine friendly, and I personally like the ability to hide URL
> strings for security reasons.
>
> Rewrite rules are generally written in an .htaccess file, see an example
> below:
>
> RewriteEngine on
> RewriteRule ^fake_directory/?$ index.php?id=2 [NC]
>
> Though the address bar in the browser will show
> http://mydomain.com/fake_directory/, you really are serving
> http://mydomain.com/index.php?id=2.
>
> Something more dynamic (you can use regular expressions):
>
> RewriteRule ^fake_directory/([a-zA-Z0-9]+)/?$ index.php?id=2&string=$1
> [NC]
>
> The above will rewrite http://mydomain.com/fake_directory/{custom_string}/
> to http://mydomain.com/index.php?id=2&string={custom_string}
>
> I am sure someone more knowledgeable will be able to provide you with a
> better explanation - I have only just started learning it. You could also
> search the web for 'mod_rewrite', there are quite a few good tutorials
> around. I found
> http://www.workingwith.me.uk/articles/scripting/mod_rewrite/ quite
> helpful. I must warn you - mod_rewrite is addictive ;-)
>
> Good luck,
>
> Ed
>
>
> ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet
> News==----
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+
> Newsgroups
> ----= East and West-Coast Server Farms - Total Privacy via Encryption
> =----
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация