i need to reditrect
this url
http://www.mydomain.com/folder/Templates/ShowPage.asp?DBID=1&LNGID=1&TMID=10000&FID=579
to
http://www.mydomain.com/folder/Templates/showpage.asp?DBID=1&LNGID=1&TMID=302&FID=569
i'm using "Helicon Tech : ISAPI_Rewrite 3.0" on server 2003 iis 6
i tried
RewriteRule ^folder/templates/showpage\.asp?dbid=1&lngid=1&tmid=10000&fid=579$ /folder/templates/showpage.asp?dbid=1&lngid=1&tmid=302&fid=569 [NC,R=301,L]
Please, try using:
(You may ommit 'RewriteBase /' directive, then use '/' in front of 'folder/...')
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} ^DBID=1&LNGID=1&TMID=10000&FID=579$ [NC,L]
RewriteRule ^folder/Templates/ShowPage.asp$ /folder/Templates/showpage.asp?DBID=1&LNGID=1&TMID=302&FID=569? [NC,L]
Related
I'm tring to redirect the following paths on our old site:
/apps
/apps/about
/apps/everything_else
/site
To a different subdomain using the following RewriteRule:
RewriteRule ^site/?$ http://site.newsite.com [R=301,NC,L]
but nothing happens, is anything wrong with this rule? Also, how do I add the apps to the same rule?
Will the following work:
RewriteRule ^site/?|apps(/.)?$ http://site.newsite.com [R=301,NC,L]
You may try this:
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/(apps|site).* [NC]
RewriteRule .* http://site.newsite.com/ [R=301,L]
Maps silently:
http://site.oldsite.com/apps or
http://site.oldsite.com/apps/anything or
http://site.oldsite.com/site or
http://site.oldsite.com/site/anything
To:
http://site.newsite.com/
Nothing is passed to the substitution URL as the OP does not mention that requirement in the question.
Strings apps and site are assumed to be fixed.
For silent mapping, replace [R=301,L] with [L]
Is there a way with ISAPI v3 to allow a subdomain to only hit a specific folder, and all other requests would redirect to www? I also have some urls under this folder that need to be rewritten. There will also be rewrite rules for valid www urls.
Allow:
http://myaccount.mysite.com/account/
http://myaccount.mysite.com/account/profile/
http://myaccount.mysite.com/account/profile/changeEmail.aspx
Allow, but needs to be rewritten:
http://myaccount.mysite.com/account/edit/123456789.aspx
These should be redirected to www:
http://myaccount.mysite.com/directory/
http://myaccount.mysite.com/folder1/
http://myaccount.mysite.com/folder1/folder2/
etc....
Try using the following:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP:Host} ^myaccount\.mysite\.com$ [NC]
RewriteRule ^account/edit/123456.aspx$ /otherpage [NC,L]
RewriteCond %{HTTP:Host} ^myaccount\.mysite\.com$ [NC]
RewriteRule ^account/.*$ - [NC,L]
RewriteCond %{HTTP:Host} ^myaccount\.mysite\.com$ [NC]
RewriteRule (.*) http://www.mysite.com/$1 [NC,R=301,L]
I have the following rules defined in my helicon file:
RewriteEngine on
RewriteCond %{HTTP:Host} ^current.mydomain.com$ [NC]
RewriteRule /reg http://another.mydomain.com/registration [NC, P]
When I navigate to the URL http://current.mydomain.com/reg I just receive a blank page. It doesn't seem to be that Helicon is forwarding the request to the other site. Any ideas why?
try using the following istead:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP:Host} ^current\.mydomain\.com$ [NC]
RewriteRule ^reg http://another.mydomain.com/registration [NC,P]
I'm at a total loss trying to integrate a mod_rewrite in my existing page. Currently, I am building a new site from scratch, and there i have some nice clean url's such as:
http://www.example.nl/nl/example
The old site, running Cms made simple, has some not-rewritten url's that would need to be redirected to the new pages. Those url's look like this:
http://www.example.nl/index.php?page=cake-and-pie&hl=nl_NL
But shorter versions of that like:
http://www.example.nl/index.php?page=cake-and-pie
also work.
It took me a while to figure out that url's with parameters cannot simply be redirected with "Redirect 301", like i'd normaly do. So i tried some online mod_rewrite generators like this and this, but the rules outputted by those result only in 404 errors, (the redirect doesn't work at all).
My .htaccess file current looks like this:
RewriteEngine On
RewriteBase /
# remove .php;
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP
RewriteRule (.*)\.php$ $1 [R=301]
# remove index
RewriteRule (.*)/index$ $1/ [R=301]
# remove slash if not directory
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /$
RewriteRule (.*)/ $1 [R=301]
# add .php to access file, but don't redirect
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
The old pages would seize to exist.
How do i redirect the old pages to the new ones?
Thanks.
EDIT
RewriteCond %{QUERY_STRING} =page=pie
RewriteRule ^index\.php$ /nl/? [L,R=301]
RewriteCond %{QUERY_STRING} =page=pie&hl=nl_NL
RewriteRule ^index\.php$ /nl/? [L,R=301]
Seems to do the trick. This is of course manual for every url, but i only have a few.
RewriteEngine On
RewriteBase /
RewriteRule ^(.+)/([^/]+)/?$ index.php?page=$1&hl=$2
RewriteRule ^([^/]+)/?$ index.php?page=$1 [QSA]
I've read through a ton of posts and pages trying to figure this out. I have it mostly working. I have a .htaccess file setup and I'm trying to redirect (301) any page in my site from non-www to www version.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
It seems to work from the base url. However, it doesn't redirect for sub pages.
This works:
example.com -> www.example.com
This does NOT work:
example.com/foo.html -> www.example.com/foo.html
Any help would be much appreciated
I think you need to add a \ to escape the dot in your domain (line 2).
As in:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(.*)\.yourdomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
...as seen here: http://www.hostingdiscussion.com/promotion-marketing/26083-301-redirect-non-www-www-vice-versa-good-search-engine-optimization-technique.html
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Here's my rule that work in my prod environment:
# If domain name without "www", add them:
RewriteCond %{HTTP_HOST} ^mydomainname\.(fr|com|net|org|eu) [NC]
# without www => force redirection:
RewriteRule (.*) http://www.mydomainname.%1$1 [QSA,R=301,L]