irkevin Posted January 28, 2009 Share Posted January 28, 2009 Hi, I don't know if this is the right place to post this, if it isn't, please move it. I'm trying to use ur mod-rewrite to make my url look nice. Here is the code Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteRule ^completed/([0-9]+)/$ /index.php?page=CompledSeries&id=$1 [NC,L] the dynamic url is http://www.mu-anime.com/index.php?page=CompletedSeries&id=1 and using mod_rewrite, its like this http://www.mu-anime.com/completed/1/, but the only problem is that it doesn't display my images and also, the css isn't working anymore.. Why is it so? Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/ Share on other sites More sharing options...
gevans Posted January 28, 2009 Share Posted January 28, 2009 Because of the new url the browser thinks your in a different directory so if your css used to be... root/css/default.css it's now going; root/completed/1/css/default.css which doesn't exist (same for images) What you want is the full http://url when calling files. You can set this in a variable in a common include page then use that variable, so an image would be <img src="<?php echo $YOUR_SITE_URL ?>images/the_imag.jpg" /> Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748404 Share on other sites More sharing options...
irkevin Posted January 28, 2009 Author Share Posted January 28, 2009 this is working, thanks for your help but now, my database content isn't showing up with this new url .. Do you know how to fix this? Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748407 Share on other sites More sharing options...
gevans Posted January 28, 2009 Share Posted January 28, 2009 That's a new one for me, are you getting any errors? Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748411 Share on other sites More sharing options...
irkevin Posted January 28, 2009 Author Share Posted January 28, 2009 no errors, but the place where the contents should show is blank. Here is the code Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteRule ^completed/(.*)\.html$ /index.php?page=$1&id=$2 [L] Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748412 Share on other sites More sharing options...
gevans Posted January 28, 2009 Share Posted January 28, 2009 Your onlt searching for one string. $2 doesn't exsist. So your passing a page but not an id Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748417 Share on other sites More sharing options...
irkevin Posted January 28, 2009 Author Share Posted January 28, 2009 ah its working now.. Hava a look at the codes Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteRule ^completed/([0-9]+)\.html$ /index.php?page=CompletedSeries&id=$1 [L] This wont cause any further problem i presume? Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748421 Share on other sites More sharing options...
gevans Posted January 28, 2009 Share Posted January 28, 2009 It should be fine, looks good to me Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748422 Share on other sites More sharing options...
irkevin Posted January 28, 2009 Author Share Posted January 28, 2009 I have another question if you don't mind. Right now the links on my website, when i click them, they still points to the dynamic urls.. is there a way so that when i click the links, it shows the nice url in the address bar? Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748424 Share on other sites More sharing options...
gevans Posted January 28, 2009 Share Posted January 28, 2009 Change the way you write them.... If it's just done in HTML change them! Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748428 Share on other sites More sharing options...
irkevin Posted January 28, 2009 Author Share Posted January 28, 2009 well all my links comes from the database. What if i add another link in the database? Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748430 Share on other sites More sharing options...
gevans Posted January 28, 2009 Share Posted January 28, 2009 Are you using a cms? Or someone else's system? Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748433 Share on other sites More sharing options...
irkevin Posted January 28, 2009 Author Share Posted January 28, 2009 its a little cms i did myself.. Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748437 Share on other sites More sharing options...
gevans Posted January 28, 2009 Share Posted January 28, 2009 In which ase you should be able to figure this out yourself Either run a query to update all the urls taht are currently in the database, or re-write them as you get them out of the database. You'll also need to work on how you add them if you need a different url format. Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748441 Share on other sites More sharing options...
irkevin Posted January 28, 2009 Author Share Posted January 28, 2009 In which ase you should be able to figure this out yourself Haha i was sure you would say something like that Good i'll try this ASAP and thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748448 Share on other sites More sharing options...
gevans Posted January 28, 2009 Share Posted January 28, 2009 No worries, good luck Quote Link to comment https://forums.phpfreaks.com/topic/142786-url-help/#findComment-748451 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.