Solved

About url rewrite

Posted on 2011-03-09
10
274 Views
Last Modified: 2013-12-13
Since it is a Rewrite question not sure I should post it here:

At root level is a dir /nav_excerpts/ it contains excerpts.php
excerpts.php generates a link as follow (here on dev machine) http://localhost/member/profile.php?username=Paul
I am trying to rewrite it so it will read http://localhost/member/profile-Paul.html
Obviously the following is not working

RewriteRule ^member/profile-([a-z0-9]+)\.html$ /member/profile.php?username=$1 [L]
0
Comment
Question by:array007
  • 5
  • 5
10 Comments
 
LVL 5

Expert Comment

by:onemadeye
ID: 35086590
So.. you have this file 'excerpts.php' :
http://localhost//dir/nav_excerpts/excerpts.php

and want it to be accessible through (for example):
http://localhost/member/profile-Paul.html
0
 
LVL 1

Author Comment

by:array007
ID: 35086661
Yes that is correct (you have a little typo, after localhost //)
Thanks
0
 
LVL 5

Expert Comment

by:onemadeye
ID: 35086807
And where is the HTACCESS file located? Is it in 'dir' directory?

Also, is this link is already accessible :
http://localhost/member/profile.php?username=Paul

And last, in your htaccess file, try to replace [L] with [R] or [R,NC,L] and see if the page redirects you to a correct location.
0
 
LVL 1

Author Comment

by:array007
ID: 35086885
Thanks that .htaccesss in at root level
I tried the [R,NC,L] but to no avail
0
 
LVL 5

Expert Comment

by:onemadeye
ID: 35086951
Okay...
(A) http://localhost/member/profile.php?username=Paul
(B) http://localhost/member/profile-Paul.html

If you try to open (A) on your browser, does it show the correct page?

If (A) is not accessible then I think there's no way that (B) will be accessible.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 5

Expert Comment

by:onemadeye
ID: 35086970
[R,NC,L]
If you use it on htaccess as I told you, whenever you open (B) check on address bar, it should be redirects you back to (A) .. in other words the URL typed on address bar is changing to (A)
Is it ?
0
 
LVL 1

Author Comment

by:array007
ID: 35087159
A, works fine but the url is not at all rewritten
B, could not be accessed as it is not anywhere in sight
sorry for the headache!
Also before you ask, yes rewrite is on.
0
 
LVL 5

Accepted Solution

by:
onemadeye earned 500 total points
ID: 35087249
Yes I can see that (B) cannot be accessed, but check on the address bar does the URL redirects you back to (A) when you use [R,NC,L]

Try this too :
RewriteRule ^member/profile-([a-z0-9]+)\.html$ member/profile.php?username=$1 [L]

Open in new window

0
 
LVL 1

Author Comment

by:array007
ID: 35087347
Sorry, no the URL does not redirect
as is when overing the link, it still show the GET mode type URL
I will need to perform a live test on my server to see if live makes a difference.
Then I will report back
thanks
0
 
LVL 1

Author Closing Comment

by:array007
ID: 35108381
Thanks, it works on live server
don't know why it's not working on my test bed.
Anyway done!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now