Subdomain htaccess Rewriting - .htaccess

I have dashboard.domain.com that acts as a dashboard for clients.
In the .htaccess file for the subdomain I have..
RewriteRule ^v/([a-zA-Z])/ index.php?flag=$1 [L]
In the dashboard navigation I have two links: "/v/t" and "/logout"
As the rewrite rule stands, it works for the /v/ links, but when I go to the logout link, it throws up a 404 error. What am I missing in my rewrite?

What am I missing in my rewrite?
Emm, ^v/ in yours regexp and lack of it in the "/logout" link?

Related

redirect any link to specific url (.htaccess)

I want to redirect
/public/courses/((anything)) to /courses
this is my code , it does not working
Redirect 301 /public/courses/.* /courses
How can I explain any link to .haccess file?
Please try following htaccess Rule. Make sure to place this rule top of your htaccess Rules file.
Please clear your browser cache before testing your URLs.
RewriteEngine ON
RewriteRule ^public/courses/.*$ /courses [R=301,L]

Opencart dont redirect not found links

I migrated my e-commerce site oscommerce to open-cart and my old links coming to the open-cart site. whenever old links requested open-cart redirects to the homepage if the pattern is like this .../index.php?manufacturers_id=...
I changed .htacess file to exclude redirect to the homepage by defining these lines
RewriteCond %{REQUEST_URI} manufacturers_id
RewriteRule .* NOT.php
if requested url contains manufacturers_id "it will" redirect to NOT.php instead homepage. But these .htaccess definitions don't work
I also want to cancel 404 pages I prefer to use the server default error page.
How can I make this? Thank you

How to 301 redirect example.com/http://cnn.com/page to example.com/cnn/page?

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!

301 redirect old link to new sub directory

I am trying to do a redirect in my Joomla .htaccess file
The incorrect link is:
http://nilandsplace.com/index.php/camping_eng/camping?___store=camping_eng
I am trying to get it to go to:
http://nilandsplace.com/store/index.php/camping/camping-home/?___store=camping
No mater what 301 redirect I have tried it does not work I get a 404 page not found or I get a 500 server error. It also could just go to:
http://nilandsplace.com/store/camping/
I almost got it to work by getting rid of the index.php in the link, but there are a lot of old external links in that have it with the index.php. I have tried more then 15 different ways and still can't get it without destroying my Joomla link
http://nilandsplace.com/index.php
I know the basics, the rewrite engine is on and I have been putting everything before the Joomla redirects that are many. The Joomla .htaccess is the basic one that comes with Joomla install.
Thanks James Niland
http://nilandsplace.com
You can use this rule as your very first rule in your root .htaccess:
RewriteCond %{THE_REQUEST} /camping_eng/camping\?___store=camping_eng [NC]
RewriteRule ^ /store/camping/? [R=301,L]

Redirecting 404 error with .htaccess via 301 for SEO etc

I couldn't find a straight answer to my question and need to know it from the real experts.
I had a website which urls were generated by Joomla. I believe that tons of urls are around in the search engines and I really don't know which of them all. A 302 redirect would be an option, but I can't say which urls need to be redirected.
The only thing I know that all the urls were generated by a sef404 script, it's a SEO script for Joomla.
My question, how can I make sure that all the orphan urls on google and other search engines are delivered correctly with a .htaccess file?
How do I 301 redirect all 404 pages to the homepage (root document)
At the moment I use a custom 404.html error file, but there are too many files and will give a rollercoaster of custom 404 error pages
I came up with the solution and posted it on my blog
http://web.archive.org/web/20130310123646/http://onlinemarketingexperts.com.au/2013/01/how-to-permanently-redirect-301-all-404-missing-pages-in-htaccess/
here is the htaccess code also
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . / [L,R=301]
but I posted other solutions on my blog too, it depends what you need really
You will need to know something about the URLs, like do they have a specific directory or some query string element because you have to match for something. Otherwise you will have to redirect on the 404. If this is what is required then do something like this in your .htaccess:
ErrorDocument 404 /index.php
An error page redirect must be relative to root so you cannot use www.mydomain.com.
If you have a pattern to match too then use 301 instead of 302 because 301 is permanent and 302 is temporary. A 301 will get the old URLs removed from the search engines and the 302 will not.
Mod Rewrite Reference: http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

Resources