I'm trying to make mysite.com/qr/anything redirect silently to mysite.com/qrengine/anything.
Here's how .htaccess file is set:
RewriteEngine On
RewriteRule ^qr/(.*)$ /qrengine/$1 [QSA]
It redirects fine, but won't mask the URL - user sees folder /qrengine/anything instead of /qr/anything as desired.
From what I've read here in stackoverflow, it should be masking the URL and I have no idea why it's not.
Can anybody please help? Tried everything within my reach.
Thanks
Related
I have an .htaccess file defined at www.mydomain/documentation/.htaccess and am trying to redirect a number of broken links to a specific page.
The .htaccess file contains the Rewrite Rule
RewriteRule ^/?(documentation/PresentationCore~System\.Windows\.RoutedEventArgs).*$
/documentation/v4.x/SciChart_WPF_v4_SDK_User_Manual.html [R,L,NC]
Note: RewriteEngine ON has already been defined. Other rules are being applied
Now in .htaccess tester the rule is being evaluated and redirects correctly when the following URL is requested:
www.mydomain.com/documentation/PresentationCore~System.Windows.RoutedEventArgs~Handled.html
However, when the same domain is entered into the browser, I get a 404 not found for this page.
I can confirm I have uploaded .htaccess to the correct folder and cleared the server cache.
Is there anything else I need to do to get this to work?
You dont need to match the folder name if htaccess is already in that folder, try :
RewriteRule ^/?(PresentationCore~System\.Windows\.RoutedEventArgs).*$
/documentation/v4.x/SciChart_WPF_v4_SDK_User_Manual.html [R,L,NC]
I have tried alot to redirect url like
http://flexsin.org/lab/wordpress/interiorfoliage/product/cylinder/
to
http://flexsin.org/lab/wordpress/interiorfoliage/cylinder/
For this I am using this code
RewriteRule ^product/(.*)$ http://flexsin.org/lab/wordpress/interiorfoliage/$1/ [L,R=301]
but it's not working for me. i want's to remove product from url and all url as it is.
so plz suggest me where i am wrong.
I'm setting up a project where users can get information about specific pages.
How can I redirect urls in htaccess that look like:
http://www.example.com/http://www.cnn.com/article1.html
to:
http://www.example.com/cnn/article1.html
It is ok if the htaccess specifies cnn and not all dynamic web addresses.
I tried using 301 directory redirects but I think the "http://" part of it is confusing it.
I tried using 301 directory redirects like the following code, but the http:// part is still confusing it:
RewriteRule ^http://youtube.com/(.*)$ /youtube/$1 [L,R=301]
RewriteRule http://www.example.com/http://youtube.com/(.*)$ /youtube/$1 [L,R=301]
This code below works properly to redirect example.com/youtube.com/watch?v=videoid to example.com/youtube/watch?v=videoid:
RewriteRule ^youtube.com/(.*)$ /youtube/$1 [L,R=301]
but if the user types in a link with http:// in it then the server cannot currently redirect properly.
Even better, if you can remove the /http:// and /https:// altogether from http://example.com/http://url.com and http://example.com/https://url.com to redirect to http://example.com/url.com/ then the redirect code that I have working in the youtube example will fix the issue for all of the domains.
How can I do this?
Thank you!
I'm trying to show the user the content of http://www.mysite.com/booking-request?code=### when visiting a url such as http://www.mysite.com/booking/ZHTU78
I'm sure this is simple, but I cannot understand why the following rule is not working for me. All I get is a 404 error.
RewriteRule ^booking\/([\w\d]+)$ /booking-request?code=$1 [L]
If I change the rule to
RewriteRule ^booking\/([\w\d]+)$ /booking-request?code=$1 [L,R=301]
It works, but with the obvious undesirable side effect of actually redirecting the browser to http://www.mysite.com/booking-request?code=###
I've also tried changing the url to redirect to to a single / to make sure it should be looking for an existing page, but no change.
It might be pertinent to mention this is on a drupal site and /booking-request is essentially a basic page, so drupal will have some functionality to redirect this page anyway, however I wouldn't have thought it should matter in this case.
edit
Here's a link to the whole htaccess file: http://pastebin.com/KPE6DK6N
Try change the rule to:
RewriteRule ^booking/([\w\d]+)$ /booking-request?code=$1 [L]
or
RewriteRule ^booking/([\w\d]+)$ http://www.mysite.com/booking-request?code=$1 [L]
It should work.
What am i doing wrong? this rule isn't working
I want the xyz-banking(old) to xyzbanks(new)
RewriteRule ^category/xyz-banking/?$ http://www.domainname.com/category/xyzbanks/ [L,R=301]
When there are multiple categories goes to one new category...can i do this?
RewriteRule ^category/(chicos|chs|rl)/?$ http://www.domain.com/category/apparel/ [L,R=301]
Ofcourse that one is also not working.
Both rewrite rules seem to be correct and they should work.
Whenever you browse to: http://www.domain.com/category/chs/ you will be redirected to http://www.domain.com/category/apparel/ as requested, etc.
Maybe you have a problem somewhere else:
Is mod_rewrite enabled?
Make sure you have RewriteEngine On on your .htaccess or site configuration.
If using an .htaccess file, Make sure you have an AllowOverride directive that allows you to use RewriteRule there.
Try a simple redirect rule first!
Check your error and access logs to see if you can spot any error or warning message.
Take a look at the URL Rewriting Guide - Apache HTTP Server