4

We have a magento website on /store folder. Idea is, on root folder, index.php will have company website.

/store folder will have magento folder.

Idea is, www.example.com/account should load login form from

www.example.com/store/customer/account/login/ 

and

www.example.com/account/register

should load register form from

www.example.com/store/customer/account/create/

Can we do this using .htaccess?

I was trying following code

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/account
RewriteRule ^(.*)$ /store/customer/account/login/ [NC,L]

this code redirects to /accounts to /store

1
+100

A way to do it :

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/account        
RewriteRule ^(.*)$ /store/customer/account/login/ [P]

It use P Proxy flag (which implies L flag too). To use it, make sure you have mod_proxy_http and mod_proxy enable.

a2enmod proxy_http    
a2enmod proxy
service apache2 restart

These last commands can depend of your OS.

However, you need to know that Apache advice that you should not activate mod_proxy if your server is not secure (see here).

  • Will it work on xampp ? – KuKu Sep 29 '17 at 8:33
  • One more thing... Magento could already have a redirection for non-existing page in the .htaccess. Be sure to put your Rewrite command in the right place, before Magento instructions. – Nicolas PERNOT Sep 29 '17 at 8:38
  • The Rewrite commands will works with XAMPP, but you will have to enable or install modules in the proper way. I don't know how works this part of XAMPP. I don't use it. – Nicolas PERNOT Sep 29 '17 at 8:40
  • A bit of documentation for enable module on XAMPP. – Nicolas PERNOT Sep 29 '17 at 9:03
0

in your root folder put the following in your .htaccess file

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^account /store/customer/account/login/ [R=301,NC,L]
    ...
</IfModule>

if users try to surf to www.example.com/account they will be redirected to www.example.com/store/customer/account/create. Keep in mind that the URL that the users see will then also changes to www.example.com/store/customer/account/create instead of www.example.com/account

  • Actually i need alias. It means that, customer should not see that they are on www.example.com/store/customer/account/create – KuKu Sep 29 '17 at 7:58
  • sorry, didnt realise that that's your concern – juhanix Sep 29 '17 at 8:39
0

What you are expecting can be done using magento's url rewrite.
Login to your admin panel and follow below steps

1) goto catalog->URL rewrite management

2) -> click add URL Rewrite button

3) In create Url rewrite drop down select custom

4) Select store for your rewrite

5) In Target path field enter your URL which has to be shown to user i.e. account 6) In Request path field enter your URL which has to be redirected i.e. store/customer/account/login

7) In Redirect chose temporary or permanent as per your requirement
Click Save

Now access your URL and it should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.