Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website and Server Administration Forum


You are currently viewing our Website and Server Administration Forum as a guest. Please register to participate.
Login



Reply
Need some help with URL rewriting
Old 10-07-2011, 04:43 AM Need some help with URL rewriting
Novice Talker

Posts: 6
Trades: 0
Hi,

I have been reading about URL rewriting and mod_rewrite for a while but it seems I cannot make it work as I want. Here is my website I am working on:

Code:
configureweb.com/
On this site I have different type of pages such as page.php, tutorial.php, post.php and category.php. Here is how the URLs are at the moment:

Code:
configureweb.com/page.php?page=about
configureweb.com/tutorial.php?tutorial=html-tutorial
configureweb.com/post.php?post=sample-post
configureweb.com/category.php?category=hosting-and-domains
and here is how I want them to be:

Code:
configureweb.com/page/about
configureweb.com/tutorial/html-tutorial
configureweb.com/post/sample-post
configureweb.com/category/hosting-and-domains
I tried something like the following code for pages:

Code:
RewriteRule ^page/([A-Za-z0-9-]+)/?$ page.php?page=$1 [L]
Code:
<a href="page/about">About</a>
It redirects to the correct page but the stylesheet is not active and links on that page become like this:

Code:
configureweb.com/page/page/about/
What am I doing wrong?
ademmeda is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-07-2011, 09:50 AM Re: Need some help with URL rewriting
Physicsguy's Avatar
404 - Title not found

Posts: 920
Name: Scott Kaye
Location: Ontario
Trades: 0
The stylesheet is relative to the path you are visiting. So if the browser thinks that you are in /page/about, it will look for a stylesheet in /about. An easy fix for this is to put "../" before your stylesheet, like
Code:
../style.css
.

As for your links, are they dynamically generated? Try looking at PHP's basename function to get the correct values for your URLs.
__________________
Check out my
Please login or register to view this content. Registration is FREE
or my
Please login or register to view this content. Registration is FREE
!
Physicsguy is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Need some help with URL rewriting
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09804 seconds with 12 queries