skip to Main Content
http://example.com/abc/media 
TO
http://example.com/media 

How to set this URL with use of .htaccess?

2

Answers


  1. Chosen as BEST ANSWER
    RewriteCond %{REQUEST_URI} ^/abc/$
    RewriteRule .* - [E=MAGE_RUN_CODE:aaa]
    RewriteCond %{ENV:REDIRECT_MAGE_RUN_CODE} (.+)
    RewriteRule .* - [E=MAGE_RUN_CODE:%1]
    RewriteBase /abc/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /abc/index.php [L]/
    

    This is my .htaccess file.

    Now we need to remove /abc/ folder from image URL so we get all image URL from the Root directory.

    <IfModule mod_rewrite.c>
       RewriteEngine on
       RewriteRule ^.*/abc/media/(.*)$ http://%{HTTP_HOST}/media/$1 [L,R=301]
    </IfModule>
    

    Already Try this but not working on my site.


  2. Could you try:

    <IfModule mod_rewrite.c>
       RewriteEngine On 
       RewriteRule ^(.*)$ abc/$1 [L]
    </IfModule>
    

    If u using only for image. You can try with:

    <IfModule mod_rewrite.c>
       RewriteEngine on
       RewriteRule ^.*/abc/media/(.*)$ http://%{HTTP_HOST}/media/$1 [L,R=301]
    </IfModule>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search