LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 09-07-2007, 12:23 AM   #1
wanna13e
Member
 
Registered: Apr 2006
Posts: 45

Rep: Reputation: 15
Thumbs up Rewrite engine for apache


Hi All Gurus,

I have a problem with rewriting the url shown to users. I have the following configurations for my website but I do not know how can I achieve my url to be rewrite from www.mysite/foldername/files to www.mysite/files.

Below is my configuration. Is this correct?

RewriteEngine on
RewriteCond /www/www.asiacni.com.sg/adnumber/$1 -d
RewriteRule ^/([0-9]{7}c?)/(.*)? /www/www.asiacni.com.sg/$1/$2
RewriteRule ^/([0-9]{7}c?)$ /$1/ [L,R]
RewriteRule ^/([0-9]{8}c?)/(.*)? /www/www.asiacni.com.sg/$1/$2
RewriteRule ^/([0-9]{8}c?)$ /$1/ [L,R]
 
Old 09-07-2007, 12:41 AM   #2
brianmcgee
Member
 
Registered: Jun 2007
Location: Munich, Germany
Distribution: RHEL, CentOS, Fedora, SLES (...)
Posts: 399

Rep: Reputation: 38
Afaik

Code:
...
RewriteRule ^/foldername/files.* http://www.mysite/files [NC,L,R]
...
 
Old 09-11-2007, 08:08 PM   #3
wanna13e
Member
 
Registered: Apr 2006
Posts: 45

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by brianmcgee View Post
Afaik

Code:
...
RewriteRule ^/foldername/files.* http://www.mysite/files [NC,L,R]
...
Hi All,

Below is my solution.

RewriteEngine on
RewriteCond /directory/folder/$1 -d
RewriteRule ^/([0-9]{7}c?)/(.*)? /directory/$1/$2
RewriteRule ^/([0-9]{7}c?)$ /$1/ [L,R]
RewriteRule ^/([0-9]{8}c?)/(.*)? /directory/$1/$2
RewriteRule ^/([0-9]{8}c?)$ /$1/ [L,R]
 
  


Reply


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
apache rewrite help deesto Linux - Server 3 11-03-2006 02:07 PM
apache url rewrite gallew Linux - Server 0 08-25-2006 03:54 AM
Need help with Apache rewrite kinetik Linux - General 6 05-19-2006 06:02 AM
Why don't LQ rewrite urls to enhance search engine rankings? chr15t0 LQ Suggestions & Feedback 7 04-26-2006 05:49 AM


All times are GMT -5. The time now is 09:42 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration