LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-04-2015, 07:46 AM   #1
bloodstreetboy
Member
 
Registered: May 2012
Posts: 201
Blog Entries: 3

Rep: Reputation: 37
facing problem in writing htaccess rewrite rules


I have a link on browser named dashboard, It goes on
http://domain.com/my-profile
"my-profile" page is available and I can not change this url.

What I want, when I click on dashboard, it should go on following url
http://domain.com/my-account/edit-address/billing
but it should show only
http://domain.com/my-account
as url in browser

as well as if user open manually
http://domain.com/my-account
it should go on following url
http://domain.com/my-account/edit-address/billing
but it should show only
http://domain.com/my-account
as url in browser

Please help me to manage this through htaccess.
What I have written till now

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

RewriteRule ^my-profile/(.*)$ /my-account/edit-address/billing [NC,R=301,L]
RewriteRule ^my-account/$ /my-account/edit-address/billing [NC,R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
If I try to open my-profile or my-account, it goes on
http://domain.com/my-account/edit-address/billing
but it does not show chopped url.
Please help me to show chopped url.

Thanks
 
Old 09-04-2015, 05:36 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 12,787

Rep: Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847Reputation: 1847
Hi,

You may use this:
Code:
RewriteRule ^my-profile/(.*)$ /my-account/edit-address/billing/? [NC,L]
RewriteRule ^my-account/$ /my-account/edit-address/billing/? [NC,L]
The "?" at the end is used to stop rewritting and you do not need the R=301 redirect

Regards

Last edited by bathory; 09-04-2015 at 05:48 PM. Reason: typos
 
  


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
proxy problem use apache rewrite rules xiutuo Linux - Server 2 04-19-2013 02:48 AM
htaccess rewrite rule asifbasha Linux - Server 1 09-21-2011 01:48 PM
.htaccess rewrite issues crypted Linux - Server 2 12-12-2010 04:20 PM
[SOLVED] Debian, Lenny, suEXEC, Apache2, .htaccess rewrite rules don't work anymore. Mogget Linux - Server 1 07-10-2010 07:33 PM
.htaccess rewrite problem skylimit123 Linux - Server 6 04-02-2010 12:42 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:26 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration