harikt
July 9, 2010, 12:17pm
1
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 ?
I’m not an expert here, but I think you should use Aliases rather than Redirects.
dklynn
July 10, 2010, 10:32pm
3
Hari,
You’re welcome.
No, the code was correct as it follows the example at Apache’s mod_alias Redirect page.
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
harikt
July 10, 2010, 11:52am
4
Thanks D K ,
But I don’t know why this code gave me a 500 internal error .
Redirect /images http://example.com/dev/joomla/images
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 .
dklynn
July 9, 2010, 10:40pm
5
Hi Hari!
You had the correct idea: Use mod_alias’s Redirect to make that redirect for you.
/images => dev/joomla/images is simply
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