Solved

About url rewrite

Posted on 2011-03-09
10
278 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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 …

860 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