I have joomla in a hosting, and it is working fine.
But I want to create a small webservice for an app, so I created a subfolder in my root folder to have access like this: www.mydomain.com/myfolder
The problem is, the .htaccess is automatically redirecting me to the joomla index. I don't have experience with the .htaccess configuration at all. I have been reading some tutorials, but every time I change something, the joomla stops working properly.
Here is my htaccess file:
rewriterule ^component/users/(.*)$ index.php?option=com_comprofiler&task=login [L]
rewritecond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
rewritecond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%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]
rewriterule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
rewritecond %{REQUEST_URI} !^/index\.php
rewritecond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
rewritecond %{REQUEST_FILENAME} !-f
rewritecond %{REQUEST_FILENAME} !-d
rewriterule .* index.php [L]
Creating a subdomain is not an option (I only have access to the ftp)
thanks
Right after rewritecond %{REQUEST_URI} !^/index\.php, add:
RewriteCond %{REQUEST_URI} !^/myfolder/
That should exclude any request for /myfolder/ from getting routed to joomla's index.php file.
Related
The content is currently accessed through this URL: http://website.de/de/angebot/llm
On our brochures we would like to print the short URL for our customers, so the above URL can be accessed when entering short URL like this: http://website.de/llm
This is what I got so far:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/llm http://website.de/de/angebot/llm [QSA,NC,L]
It works in the way of redirecting clients. So when they enter short URL they are properly redirected to long URL.
What I would like if it is possible that URL doesn't change to the long one, but stays short in their browsers.
This is the full .htaccess
# Exploits
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%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]
#Custom
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?llm de/angebot/llm [NC,L]
# Joomla
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
With joomla you could create a redirect within joomla that would help you achieve this.
You could as well create a menu item as an alias to your long url.
In .htacess I would try something like:
RewriteCond %{HTTP_HOST} ^yourdomain.com/llm$ [NC]
RewriteRule ^$ http://www.yourdomain.com/de/angebot/llm [R=301,L]
I want to redirect example.com to example.au,but at the same time i want to exclude example.com/admin from redirection. Is it possible if yes please provide any rewrite rules.Any help would be appreciated.
Code:
RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} !^/admin [NC]
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
#RewriteRule .* index.php [L]
RewriteRule ^(.*)$ www.example.com.au/$1 [R=301,L]
RewriteRule !^(admin/.*)$ www.example.com.au/$1 [R=301,L]
You can use following .htaccess redirection code for access admin
GeoIPEnable On
ReWriteEngine On
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} IN$ //IN is the country code where you want to redirect
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
RewriteCond %{REQUEST_URI} !admin
RewriteCond %{REQUEST_URI} !index.php [NC] //admin keywords
RewriteRule ^ http://www.domain.in [R=301,L] //redirection url
In the above example admin and index.php are the keywords for accessing admin
RewriteCond %{REQUEST_URI} !admin
RewriteCond %{REQUEST_URI} !index.php [NC]
It means redirect to specific url in INDIA,only when the current url doesn't have the above keywords(all admin modules only have these keywords).
It would be help you. I'm also using the above same code for my store
All the best
EDIT : You can refer the following threads too for getting some more details
Some admin modules redirect to frontend
Magento redirection with htaccess based on country wise
I want to remove index.php from all admin URLs in Magento. I have written the following code in my .htaccess file.
Magento is installed in a subdomain.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^test\.domain\.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /test/$1
RewriteCond %{HTTP_HOST} ^test\.domain\.com$
RewriteRule ^(/)?$ test/ [L]
RewriteBase /test/
RewriteRule ^api/rest api.php?type=rest [QSA,L]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php
RewriteCond %{REQUEST_URI} ^(.*)index.php/admin.*$
RewriteRule ^index.php/admin(.*) /admin$1 [L,R]
By this code I have found success in my requirement, but now I am unable to save data. Please help me if any one has idea about this.
Any help will be appreciable.
If your all settings are correct and you are making the changes on Live server, then you need to wait at least one day as the
Live Server takes some time to change the htaccess configuration setting. ;)
I have the following folder structure:
www-root
Backend
Config
Etc
Frontend
Administration
StoreFront
I would like to be able to access the directories from the main url and hiding the subdirectories in between.
So the administrative part I should be able to access like this:
http://localhost/Administration/
The main page which is stored in the subdirectory "StoreFront", I want to be able to access from the root:
http://localhost
This is the code in my .htaccess file so far:
# Store Redirect
RewriteEngine on
RewriteCond %{HTTP_HOST} ^localhost [NC]
RewriteCond %{REQUEST_URI} !^/Frontend/StoreFront
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /Frontend/StoreFront/$1
RewriteCond %{HTTP_HOST} ^localhost [NC]
RewriteRule ^(/)?$ /Frontend/StoreFront/index.php [L]
RewriteCond %{REQUEST_URI} !^/Administration
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /Frontend/Administration/$2
This code however does not work correctly. It rewrites every file except the index.php file to the Administration subdirectory. One side note: php files which are in the backend directory should remain "includable" from the frontend.
Let me tell upfront you that what you're trying to achieve is mission impossible, now let me tell you why. You have this rule:
RewriteRule ^(.*)$ /Frontend/StoreFront/$1
and down further you have:
RewriteRule ^(.*)$ /Frontend/Administration/$2
You cannot have .* going to both the places. You need to distinguish these 2 paths somehow.
It is besides the point that you have other problems also e.g.:
Not using L (LAST) flag wherever needed
Using $2 instead of $1 in 2nd rule
EDIT: Based on your comments:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^(Administration(?:/.*|))$ /Frontend/$1 [L,NC]
RewriteCond %{HTTP_HOST} ^localhost [NC]
RewriteRule ^$ /Frontend/StoreFront/index.php [L]
RewriteCond %{HTTP_HOST} ^localhost [NC]
RewriteCond %{REQUEST_URI} !^/Frontend/StoreFront
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /Frontend/StoreFront/$1 [L]
i have a redirect in my htaccess which works perfectly in joomla before i swicth on SEF URLS
RewriteRule ^m/(.*) /index.php?option=com_seemail&view=mail&guid=$1&itemid=102
however when i switch on SEF URLS then it no longer works - im directed to /home/uncategorised/welcome instead
this is my htaccess :
RewriteEngine On
RewriteRule ^m/(.*) /index.php?option=com_seemail&view=mail&guid=$1&itemid=102
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^apply$ /index.php?option=com_loans&view=apply&Itemid=102 [R=301,L,QSA]
RewriteBase /
DirectoryIndex index.php
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]
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]
can anyone help please ?
RewriteRule ^apply$ /index.php?option=com_loans&view=apply&Itemid=102 [R=301,L,QSA]
based on the above line of code, if there is nothing after "apply" in the url, it should redirect to /index.php?option=com_loans&view=apply&Itemid=102 and stop looking at other rules for the said case.
As you said it is redirecting that means it is working.
Can you manually open the <yourdomain.com>/index.php?option=com_loans&view=apply&Itemid=102
If it opens and the url is sef, copy the sef url after the domain and replace /index.php?option=com_loans&view=apply&Itemid=102 with that in the RewriteRule.
May be that should work.