Apache mod_rewrite: from 'friendly' url to actual path


 
Thread Tools Search this Thread
Top Forums Web Development Apache mod_rewrite: from 'friendly' url to actual path
# 1  
Old 09-05-2009
Apache mod_rewrite: from 'friendly' url to actual path

I'd like to translate a friendly url such as:
http://www.xxxyyyzzz.com/page/12345678/
to:
http://www.xxxyyyzzz.com/page/12/34/56/78/

Seems simple enough, but I cannot figure out how. Any one done this before?
# 2  
Old 09-06-2009
Quote:
Originally Posted by markericksen
I'd like to translate a friendly url such as:
http://www.xxxyyyzzz.com/page/12345678/
to:
http://www.xxxyyyzzz.com/page/12/34/56/78/

Seems simple enough, but I cannot figure out how. Any one done this before?
I have not tried this, but, off the top of my head, you can try something like:

Code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^page\/([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})\/$  page/$1/$2/$3/$4/   [R=301,NC,L]

# 3  
Old 09-06-2009
Thank you. Your response was very helpful!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Web Development

Mod_rewrite - URL rewrite based upon HTTP_REFERER

Hello, I have added following rewrite cond and rewrite rules but it does not work. RewriteCond %{HTTP_REFERER} ^http://192\.168\.1\.150/categories/.*$ RewriteRule ^(.*)$ http://www.blahblah.com/ When I hit url : http://192.168.1.150/categories/881-Goes?page=7 in my browser - it... (2 Replies)
Discussion started by: ashokvpp
2 Replies

2. UNIX for Advanced & Expert Users

Apache Mod_rewrite Mystery

Hi Folks, I am running on a CentOS 6.3 server, whose primary function until recently has been my Zimbra mail server exclusively. I added wordpress and I have not been disappointed, with this one exception of Apache mod_rewrite. I have already tried to set selinux to permisive to eliminate that... (5 Replies)
Discussion started by: cjm51213
5 Replies

3. Web Development

apache url redirection

I need help in apache url redirection: I have added the below command in httpd.conf and it is working fine. Redirect http://xyz.com/site/homehttp://abc.com/site/home Can we set a rule such that http://xyz.com/site/* -> http://abc.com/site/* is applied For... (0 Replies)
Discussion started by: raghur77
0 Replies

4. Shell Programming and Scripting

Converting MSVC /showInclude to unix friendly path

Hi guys, I've been trying to do this for hours, and I've just been running around in circles trying to get this script made. I have a set of files outputted by an MSVC compiler that looks like this 1> helloworld.cpp 1> Note: including file: c:\dev\test\makefile\source\helloworld.h 1> ... (7 Replies)
Discussion started by: krad
7 Replies

5. Web Development

Apache Virtual URL

Hi All, i'am facing a problem with urls that don't have a filestructure under DocumentRoot. A URL like http://mydomain.com/applicationrew/Structure1/Structure2/some?parameter=key&parameter1=key1 Should be rewritet to something else. Now i defined a Location like <Location ~... (3 Replies)
Discussion started by: wuschelz
3 Replies

6. Web Development

APACHE rewrite / redirect URL

Hello. I have scenario where a Client send request to Server1. Server1 send request to Server2. Request are xmlHTTPRequest - need to get data (XML) from Server2 back to client. Trying to use APACHE proxy... Anyone can help? What to download / configure / ...? Thank you for your... (2 Replies)
Discussion started by: ampo
2 Replies

7. Cybersecurity

APACHE rewrite / redirect URL

Hello. I have scenario where a Client send request to Server1. Server1 send request to Server2. Request are xmlHTTPRequest - need to get data (XML) from Server2 back to client. Trying to use APACHE proxy... Anyone can help? What to download / configure / ...? Thank you for your help. (1 Reply)
Discussion started by: ampo
1 Replies

8. UNIX for Advanced & Expert Users

how to check the actual path instead of link path

Hi I have a path link /test/df/link1/actual/file1 here link1 is actually a softlink link1= a/b i need to print the ACTUAL FULL path instead of a linked path is there any direct command to print the actual path of any linked path eg showPhyscialPath /test/df/link1/actual/file1 and it... (4 Replies)
Discussion started by: reldb
4 Replies

9. UNIX for Dummies Questions & Answers

Apache, hiding the url

Hello, how to hide the full addres url, in apache web server. eg, www.example.org/www/pub/index.html, the address in browser only www.example.org . Thank You. (2 Replies)
Discussion started by: blesets
2 Replies
Login or Register to Ask a Question