SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jan 2010
    Location
    India
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool Poiting a folder to another location

    Hi guys,

    I have Joomla installed on example.com/dev/joomla .

    Have created a custom module so the content has images poniting to example.com/dev/joomla/images

    I have given only /images and not /dev/joomla/images , so I don't want to edit each contents . Not given just " images " for it will not show when moved to inner pages.

    The /images will point to example.com/images , but I want it to point to http://example.com/dev/joomla/images

    So I have tried to write some rewrite rules and failed .

    1 ) Redirect /images/ http://example.com/dev/joomla/images


    <code>
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
    RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
    RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
    RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
    RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
    RewriteRule ^(.*)$ index.php [F,L]
    RewriteBase /dev/joomla


    # ScriptAlias /images dev/joomla/images
    # Alias /images/ /dev/joomla/images/
    # Redirect /images/$ http://example.com/dev/joomla/images

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/index.php
    RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]

    RewriteRule (.*) index.php
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    </code>

    Is there any way ?

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,680
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    Hi Hari!

    You had the correct idea: Use mod_alias's Redirect to make that redirect for you.

    /images => dev/joomla/images is simply
    Code:
    Redirect /images http://example.com/dev/joomla/images
    Please review the mod_alias page at Apache.org as it'll show which mod_alias directives use regex and which do not.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Member
    Join Date
    Jan 2010
    Location
    India
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Thanks D K ,

    But I don't know why this code gave me a 500 internal error .

    Code CODE:
    Redirect /images [url]http://example.com/dev/joomla/images[/url]

    I may be wrong , but I think as it starts redirecting to http://example.com/dev/joomla/images , the condition here also satisfies /images , and is causing the error .

    If it was /something = > dev/joomla/images , may have worked .

    But I have done another trick making a subdomain .

    Thanks once again , and will try the other way when I get time and let you know .

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,680
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    Hari,

    You're welcome.

    No, the code was correct as it follows the example at Apache's mod_alias Redirect page.
    Quote Originally Posted by apache.org
    Redirect Directive
    Description: Sends an external redirect asking the client to fetch a different URL
    Syntax: Redirect [status] URL-path URL
    Context: server config, virtual host, directory, .htaccess
    Override: FileInfo
    Status: Base
    Module: mod_alias
    The URL-path is /images (images in the root of the webspace) and the redirection is to your /dev/joomla/images directory.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  5. #5
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not an expert here, but I think you should use Aliases rather than Redirects.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •