I have this code, it redirecs www.example.com?index.php?q=home&lang=en into www.example.com/home. I would like to redirect it into www.example.com/en/home. Is it possible?
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ index.php?q=$1&lang=$2 [L,QSA]
RewriteRule ^([^/]*)(.*)$ $1[L,QSA]
Thanks in advance
Try:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z]{2})/(.*)$ /index.php?q=$2&lang=$1 [L,QSA]
Related
I'm trying to redirect all http url to https.
I'm struggling because I need to preserve my current redirections here :
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.html?user=$1 [L,QSA]
Can you help me modify this code to include de https redirection. Thanks
Use the following rules:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.html?user=$1 [L,QSA]
I currently have a .htaccess rewrite rule that will redirect all urls containing /ws to the /ws/index.php eg. www.domain.com/ws/controller/function
RewriteEngine on
RewriteBase /ws/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
i'm looking to add another redirect, just the same, for all request that contain /email/ so www.domain.com/email/controller/function will redirect to the /email/index.php.
my full .htaccess looks like the code below but it seems the /email/ never gets called.
RewriteEngine on
RewriteBase /ws/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
RewriteEngine on
RewriteBase /email/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
I've tried adding ^/email to the RewriteRule conditional but to no avail.
Any help would be appreciated.
Thanks
You can use:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^ws/(.*)$ ws/index.php?url=$1 [NC,L,QSA]
RewriteRule ^email/(.*)$ email/index.php?url=$1 [NC,L,QSA]
From this:
http://ice-phoenix.dx.am/jlpt/form/try_question.php
To This:
http://ice-phoenix.dx.am/jlpt/try_question
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^jlpt/form/try_question\.php$ jlpt/try_question/ [L]
Can any help me?
Thank you so much.
Try this in Root/.htaccess file
RewriteEngine On
RewriteCond %{THE_REQUEST} /jlpt/form/([^.]+)\.php [NC]
RewriteRule ^ /jlpt/%1? [R,L]
RewriteRule ^jlpt/([^/]+)/?$ /jlpt/form/$1.php [L,NC]
I want to redirect
http://www.mysite.com/index.php?channels=browse&channel_id=1&sort=rated
to
http://www.mysite.com/category/cars/?r_sortby=highest_rated&r_orderby=desc
Can someone to help-me with this issue?
Thank you!
This should work for you
RewriteEngine on
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /index\.php\?channels=browse&channel_id=1&sort=rated\ HTTP
RewriteRule ^ /category/cars/?r_sortby=highest_rated&r_orderby=desc? [R=301,L]
EDIT:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/category/(.*)
RewriteRule ^(.*)$ /watch.php?tag=$1 [L]
i have a htaccess problem
all urls will redirect via access:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?load=content&url=$1
Domain www.domain.de/nicepage will redirect to www.domain.de/index.php?load=content&url=nicepage
Now I would like to redirect 'subfolder':
from www.domain.de/faq/nicefaq to www.domain.de/index.php?load=faqdetail&url=nicefaq
That's what I am try:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?load=content&url=$1
RewriteRule ^faq/(.*)$ index.php?load=faqdetail&url=$1
This does not work. everytime i call the page i will redirect to load=content.
Can You help me pls?
thanks in advance and best regards
Maddin
Both RewriteRules match against the same condition. As the first you wrote matches everything, the second is never reached. Just change the order:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^faq/(.*)$ index.php?load=faqdetail&url=$1
RewriteRule ^(.*)$ index.php?load=content&url=$1
Hope this helps...
Try this code in your .htaccess file:
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^faq/(.*)$ index.php?load=faqdetail&url=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/+faq [NC]
RewriteRule ^(.*)$ index.php?load=content&url=$1 [L,QSA]