I am having a issue redirecting my URL to another URL. I have tried 4-5 ".htaccess" codes but they were not helpful.
I want to redirect "m.onlinedealsindia.in/?page=0" to "m.onlinedealsindia.in/?page=1".
Hope to get a helpful answer.
Thank you.
You can use this rule in root .htaccess:
RewriteEngine On
#RewriteCond %{HTTP_HOST} =m.onlinedealsindia.in
RewriteCond %{QUERY_STRING} ^page=0$
RewriteRule ^/?$ ?page=1 [L,R=302]
Related
I am trying to redirect some parts of my url but for some reason it is stripping out the directory after redirect... tried many things here is the information below
when i go to this link
http://example.com/weddings/peacock-wedding.php
it redirects to
http://www.example.com/peacock-wedding.php
stripping out
/weddings/
my htaccess code
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com [nocase]
RewriteRule ^(.*) http://www.example.com/$1 [last,redirect=301]
help please!
ok figured it out!
posting answer in case anyone needs help with it
this goes in htaccess of sub directory in my case in "weddings" directory
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(example.com)?$
RewriteRule ^(.*)$ http://www.example.com/weddings/$1 [R=301,L]
I have a blog folder in the public_html folder on my server with godaddy.
The .htaccess (in public_html) :
RewriteEngine on
Options +FollowSymlinks -Multiviews -Indexes
RewriteBase /
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{THE_REQUEST} /blog/article\.php\?id=([^\s&]+) [NC]
RewriteRule ^ blog/article/%1? [R=302,L]
RewriteRule ^blog/article/([^/.]+)/?$ /blog/article.php?id=$1 [L,QSA,NC]
The page takes me to 404 page on my online host with godaddy but it works fine on localhost.
I also tried:
RewriteCond %{QUERY_STRING} (^|&)article\.php\?id=(.*)(&|$)
RewriteRule ^(.*)/article.php$ $1/article/%1? [NC,L]
but that didn't do anything.
Please help!
Figured it out. For anyone that might run into the same problem, here is the simple solution:
Make sure that your tag contains the real url.
What I did was, I put the custom url in the tag and godaddy was not recognizing it.
So what I did was
article 1
instead it should be
article 1
That way it will redirect to the custom url correctly.
Hope that helps!
i have problem of redirecting from domain with sub-directory like
http://mydomain.com/project/01/117q803789s92d01 or
http://mydomain.com/project/08/117t803789s92d08
.. etc
to always
http://ww2.mydomain.com/project/01/117q803789s92d01
the other link will to
http://ww2.mydomain.com/project/08/117t803789s92d08
... etc
i tried this
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$
RewriteRule ^project\/\/?(.*)$ "http\:\/\/ww2\.mydomain\.com\/project\/$1" [R=301,L]
but for some reason its always redirect me to wrong with missing "\" like if i try to access
http://mydomain.com/project/01/117q803789s92d01
redirect me to
http://ww2.mydomain.com/project01/117q803789s92d01
Did I miss something?!
what basically i need to just redirect from
http://mydomain.com/project/* whole url
to
http://ww2.mydomain.com/project/* with same whole url
Thanks for help in advance.
just for information the problem is solved as the htaccess script below is the right one
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$
RewriteRule ^project\/\/?(.*)$ "http\:\/\/ww2\.mydomain\.com\/project\/$1" [R=301,L]
thanks
I am updating the Iirf.ini file to redirect sub.columbia.edu to giving.columbia.edu/video.
sub.columbia.edu is already redirecting to giving.columbia.edu.
How can I go one step further to redirect it to giving.columbia.edu/video.
Important Note: I would like the URL to show as sub.columbia.edu in the browser and not as giving.columbia.edu/video
#Redirect subdomain to specific URL
RewriteCond %{HTTP_HOST} ^sub\.columbia\.edu
RewriteRule ^/$ /video
The above doesn't work. Any ideas how I should modify this?
Thank you!
You can try this and see how it works for you.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^sub\.columbia\.edu
RewriteRule ^(.*) http://giving.columbia.edu/video [L,R=301]
Or you can do a redirect, this should work also.
Redirect 301 / http://giving.columbia.edu/video
i am trying to change the url using htaccess rewrite
i want to change this url
page/details.php?name=abcdef&id=18
to
page/abcdef
Here my sample code for this
RewriteEngine On
RewriteRule ^company/([A-Za-z0-9-]+)/$1 company/details.php?name=$1&id=$2 [R=301,L]
this is not working, and also i was tried many code but not working,please help me to find htaccess code for this url
Thanks advance
This should do what you're after:
RewriteCond %{QUERY_STRING} ^.*name=([a-zA-Z0-9]*).*$
RewriteRule ^page/(.*)$ page/%1? [R=301,L]
Try this one:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^name=(.*)&id=(.*)$
RewriteRule ^page/(.*)$ /page/%1? [R=301,L]
This will check for these 2 parameters in the query string.