Balmung-San Posted January 4, 2007 Share Posted January 4, 2007 Okay, so I read the tutorial, but I'm still not entirely sure about how to clean up URLs.How's about I make a sample case.Let's say I have the following pages:http://www.mydomain.com/download.phphttp://www.mydomain.com/index.phphttp://www.mydomain.com/news.phphttp://www.mydomain.com/article.phpNow, let's say both download.php, article.php, and news.php all accept article titles as a passed variable as such:http://www.mydomain.com/article.php?title=Some-ArticleHow would I make it so that http://www.mydomain.com/article/Some-Article points to the same page, without using mod_rewrite? My webhost does not allow mod_rewrite. Quote Link to comment Share on other sites More sharing options...
fooDigi Posted January 4, 2007 Share Posted January 4, 2007 looks as though phpfreaks has a tutorial regarding this. forgive me, i have not read it all. hope this works for you.[url=http://www.phpfreaks.com/tutorials/149/0.php]http://www.phpfreaks.com/tutorials/149/0.php[/url] Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted January 4, 2007 Author Share Posted January 4, 2007 [quote author=fooDigi link=topic=120940.msg496617#msg496617 date=1167887647]looks as though phpfreaks has a tutorial regarding this. forgive me, i have not read it all. hope this works for you.[url=http://www.phpfreaks.com/tutorials/149/0.php]http://www.phpfreaks.com/tutorials/149/0.php[/url][/quote]I had already read the article and I was still confused at the end. Mostly, where would I put the parsing include? How does it know not to look in a directory named http://www.mydomain.com/article/Some-Article? Quote Link to comment Share on other sites More sharing options...
SharkBait Posted January 4, 2007 Share Posted January 4, 2007 Ignore my entire post.. I missed the part where you mentioned your host doesn't allow mod_rewrite :P[s]What I use is Apache's Mod Rewrite.Usually used in a .htaccess file and looks similar to:[/s][code]RewriteEngine OnRewriteRule ^/article/([0-9A-z]+)$ article.php?title=$1[/code][s]:) I also add hyphens into the title and then strip them out if I need to display the proper title or when I need to query my database for the content.The .htaccess file is added to the directory of your website. The previous code I used can be found here: http://www.tingram.ca/blog/Apache-mod_rewrite though it uses the ID of the post and not the title like it does now.[/s] Quote Link to comment Share on other sites More sharing options...
corbin Posted January 4, 2007 Share Posted January 4, 2007 Will your host allow you to make changes to where your 404 error file is? Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted January 4, 2007 Author Share Posted January 4, 2007 Yes, I can adjust my 404 error pages. Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted January 4, 2007 Author Share Posted January 4, 2007 Ah, just figured it out. I just had to setup some things with my 404 page. I should be able to work it now. Thanks very much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.