Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-06-2011, 10:01 AM   PM User | #1
devinmaking
Regular Coder

 
Join Date: Oct 2011
Posts: 236
Thanks: 11
Thanked 5 Times in 5 Posts
devinmaking has a little shameless behaviour in the past
mod_rewrite problem

Hi guys i am trying to get the website url to show

www.domain.com/edit-blog/username/blogId

i am using the rule

PHP Code:
RewriteRule ^edit-blog/([A-Za-z0-9-]+)/([0-9]+)/?$ users/add-blog.php?username=$1&mode=edit&id=$[L
the mod rewrite works but for some reason its only showing the html, no styles, images or javascripting. So i assume the rewrite is wrong?
devinmaking is offline   Reply With Quote
Old 10-06-2011, 10:15 AM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
So i assume the rewrite is wrong?
You may easily get it resolved by the use of absolute paths to link files.
Have a look at http://www.codingforums.com/showpost...67&postcount=9
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 10-06-2011, 10:25 AM   PM User | #3
devinmaking
Regular Coder

 
Join Date: Oct 2011
Posts: 236
Thanks: 11
Thanked 5 Times in 5 Posts
devinmaking has a little shameless behaviour in the past
Quote:
Originally Posted by abduraooft View Post
You may easily get it resolved by the use of absolute paths to link files.
Have a look at http://www.codingforums.com/showpost...67&postcount=9
For some reason that is bringing up page can not be found, if i use absolute, but that may be because i am in localhost on my computer working through wamp which means my absolute url is as follows:

localhost/folder/etc etc
devinmaking is offline   Reply With Quote
Old 10-06-2011, 10:43 AM   PM User | #4
devinmaking
Regular Coder

 
Join Date: Oct 2011
Posts: 236
Thanks: 11
Thanked 5 Times in 5 Posts
devinmaking has a little shameless behaviour in the past
The problem only arises when i ad a new rule.

For instance if i have

www.domain.com/edit-blog/$1

its fine but as soon as do this it then goes wrong

www.domain.com/edit-blog/$1/$2

Even if i add the NC within it, it does not work correctly

PHP Code:
RewriteRule ^edit-blog/([A-Za-z0-9-]+)/([0-9]+)/?$ users/add-blog.php?username=$1&mode=edit&id=$[NC,L

Last edited by devinmaking; 10-06-2011 at 10:47 AM..
devinmaking is offline   Reply With Quote
Old 10-06-2011, 12:12 PM   PM User | #5
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
Originally Posted by devinmaking View Post
For some reason that is bringing up page can not be found, if i use absolute, but that may be because i am in localhost on my computer working through wamp which means my absolute url is as follows:

localhost/folder/etc etc
Create a virtual host under your local development environment to simplify the things. Check http://www.codingforums.com/showpost...25&postcount=2 to see how to do this on xampp
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 10-06-2011, 12:15 PM   PM User | #6
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
Originally Posted by devinmaking View Post
The problem only arises when i ad a new rule.

For instance if i have

www.domain.com/edit-blog/$1

its fine but as soon as do this it then goes wrong

www.domain.com/edit-blog/$1/$2

Even if i add the NC within it, it does not work correctly

PHP Code:
RewriteRule ^edit-blog/([A-Za-z0-9-]+)/([0-9]+)/?$ users/add-blog.php?username=$1&mode=edit&id=$[NC,L
Yes, I had encountered this before and I know it very well. Each of the slashes in your rewritten url will be considered as a sub-folder by the browser, which makes the files linked using the relative paths inaccessible.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 10-06-2011, 12:52 PM   PM User | #7
devinmaking
Regular Coder

 
Join Date: Oct 2011
Posts: 236
Thanks: 11
Thanked 5 Times in 5 Posts
devinmaking has a little shameless behaviour in the past
Quote:
Originally Posted by abduraooft View Post
Yes, I had encountered this before and I know it very well. Each of the slashes in your rewritten url will be considered as a sub-folder by the browser, which makes the files linked using the relative paths inaccessible.
I have tried to do this using the .htacess

Stating the absolute url is:

RewriteBase /uaf/

But for some reason that has not cured the problem, for some reason www.domain.com/folder1/username works but as soon as i add another folder it doesnt want to:

www.domain.com/folder1/folder2/blogid

Any ideas?
devinmaking is offline   Reply With Quote
Reply

Bookmarks

Tags
mod_rewrite

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 10:10 AM.


Advertisement
Log in to turn off these ads.