Jump to content

Display of url


son

Recommended Posts

Have set up a simple content management for my own stuff and wondered how to change the url, so it looks like a 'normal' web page. Website is on an Apache server. Currently it shows for example:content.php?id=about (I use one file and depending on id passed the content changes)I know you can use rewrite_mod or similar, but am lost in what to use and not to loose the functionality (passing the id). How would you do that?Any hints, ressources, answers appreciated.Thanks,Son

Link to comment
Share on other sites

you can use .htaccess to rewrite the url's to make them 'search engine friendly'.Do a search on google and you'll find plenty of tutorials out on the web for it:)
I tried already a .htaccess solution as:
RewriteEngine OnRewriteRule ^content/(.*).php /content.php?id=$1

But it does not do a thing... Do not get it...Son

Link to comment
Share on other sites

you've missed a \, a / and a space, this is how it should be written i believe.RewriteEngine OnRewriteRule /content/(.*)\.php /content.php ?id=$1If it doesnt work, then your host may block certain htaccess rules.Hope that helps.:)

Link to comment
Share on other sites

you've missed a \, a / and a space, this is how it should be written i believe.RewriteEngine OnRewriteRule /content/(.*)\.php /content.php ?id=$1If it doesnt work, then your host may block certain htaccess rules.Hope that helps.:)
Unfortunately yours does also not work. Spoke already to host and they say those things all work, but they cannot provide help with my attempts to modify .htaccess;-)Son
Link to comment
Share on other sites

My last .htaccess entry as:Options +FollowSymLinksRewriteEngine OnRewriteRule ^/services/[a-zA-Z0-9.-]$ /services.php?id=$1 [L]still does not work. I have really read so many tutorials now|-) Where am I going wrong? SOS...Son

Link to comment
Share on other sites

First thing to check: make sure your web host supports URL rewriting. Not all do.If your web host does support it, then I suggest using a CMS that handles URL rewriting on its own, so you don't have to bother with it.
They support it and I have to find myself a solution to issue presented... Thanks anyway!Son
Link to comment
Share on other sites

Hmm, well, I played around with it and got it working.http://9494.clone-drone.net/files/BLAH/buggle.txt=9494.clone-drone.net/download.php?section=BLAH&file=buggleHere are some probelms you might have:this is my code

Options +FollowSymlinks//I never saw the this in your htaccess file you posted, try putting that in.RewriteEngine onRewriteRule ^files/([^/]+)/([^/]+).txt /download.php?section=$1&game=$2 [NC]

http://corz.org/serv/tricks/htaccess2.phpgo there for more info... that's where I got that code from.so, this would be the code you want:

Options +FollowSymlinksRewriteEngine OnRewriteRule ^content/([^/]+).php /content.php?id=$1 [NC]

so...http://localhost/content/buggle.php=http://localhost/content.php?id=buggleor(http://cmail.clone-drone.net/content/yay.php)=(http://cmail.clone-drone.net/content.php?id=yay)Hope that helps~cloneEDIT: the links don't work any more, but I am going to fix them soon.EDIT: Use this link:http://clonedrone.com/php-lab/htaccess/fil...T-ME/AND-ME.txt

Link to comment
Share on other sites

I am sorry, but I have no clue. Perhaps you might want to look into another host? (Only if your really desperate though) What host are you using anyways? (I know a few, look at my post here for some ideas)
In end I got it working with solution provided in this thread. Strange, it did not do it in first place. Is .htaccess affeced by caching? I have quite a lot of trouble with caching when working on projects...Son
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...