Apache Mod Rewrite

Associate
Joined
13 Nov 2003
Posts
1,567
Location
Manchester
Hmm that has given me a rather tasty internal server error lol

Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^news/([0-9]{1,}/?$ /show_news_article.php?id=$1
 
oh right lol

Having a small problem because I am working on my test server, so the url is http://www.fluiduk.co.uk/~dimensio/news/1

So its trying to access show_news_article.php at www.fluiduk.co.uk, not www.fluiduk.co.uk/~dimensio

Would whacking it on a sub domain help, as I dont want to have to rewrite all the rules when I stick on the live server

Aaron
EDIT - DIDNT WORK. As I cant redirect the subdomain totally, its just redirect to fluiduk.co.uk/~dimensio
 
Last edited:
so like this

Code:
Options +FollowSymLinks
RewriteEngine on
ReWrite Base /
RewriteRule news/([0-9]{1,})/?$ /show_news_article.php?id=$1

Thanks
 
Ok guys that all went over my head. Here is another challenge for you.

I have another dynamic page that uses the following url view_facilities.php?id=gym&photoid=1

The reason I am using 2 variables is because I want the word gym to be in the url, and the photo ID is so the page can call the relevant photos the user has uploaded for that page.

I would like the url to look like www.mydomain.com/facilities/gym

Is that possible, given that there is another variable in the URL?

Much Appreciated
Aaron
 
Nice one, got all that working. Thanks

Is it worth while extending this practice to every page, how would I rewrite say careers.php to mydomain.com/careers and is it worth it?

Thanks
Aaron
 
That was my thinking

Thanks for all the help guys, im off to bed lol

I will no doubt be back to pester you all tommorrow ;)

Aaron
 
Quick question with this

Is there a way to do this rewrite that doesnt involve having to add ../ to all images, css, includes etc.

Perhaps its good practice to do this ../ anyway?
 
Cool, so just set all the image urls etc to start with / should do the trick.

Does this apply to page links?

Thanks
 
Back
Top Bottom