Today's Messages (off)  | Unanswered Messages (on)

Forum: Htaccess Questions
 Topic: RewriteRule not working with special characters (like æ, ø and å)
RewriteRule not working with special characters (like æ, ø and å) [message #2082] Mon, 10 January 2011 13:37
infidel
Messages: 1
Registered: January 2011
Hey, I use .htaccess to make requests like mydomain.com/myFolder/path/file.ext turn into mydomain.com/myFolder/?d=path/file.ext but it doesn't work with special characters like æ, ø and å. How can I solve this? Here's the content of my file:

Options +FollowSymLinks

RewriteEngine on
RewriteBase /myFolder/
RewriteCond %{REQUEST_FILENAME}  -d
RewriteRule ^(.+[^/])$           $1/  [R]
RewriteCond %{REQUEST_FILENAME}  -d
RewriteRule ^(.+/)$ /myFolder/?d=$1 [QSA,L]
 Topic: htaccess site redirection for multiple domains mapped to same directory
icon5.gif  htaccess site redirection for multiple domains mapped to same directory [message #2080] Sun, 09 January 2011 13:41
Business Events  is currently offline Business Events
Messages: 1
Registered: January 2011
Location: Leeds, UK
Hi all,

I am really hoping someone will be able to help me with this as it is driving me mad!

What is want to do is have the .htaccess file to get the URL and use that URL for redirections etc.

I have 5 sites that are all mapped to the same html_directory as they all use the same layout and some of the data is shared between them.

What I need is something that will allow the .htaccess file to do redirects to the URL in the address bar and if errors happen they are redirected to the URL shown and not the manual URL written in the .htaccess file.

Example One or two

ErrorDocument 404 http://www.EXAMPLEURL.com/faq/unavailable
ErrorDocument 500 http://www.EXAMPLEURL.com/faq/unavailable
ErrorDocument 403 http://www.EXAMPLEURL.com/faq/unavailable


RewriteEngine on
RewriteCond %{HTTP_HOST} ^EXAMPLEURL.com$ [NC]
RewriteRule ^(.*)$ http://EXAMPLEURL.com/$1 [R=301,L]

Example Two

ErrorDocument 404 http://((GET HTTP_HOST))/faq/unavailable
ErrorDocument 500 http://((GET HTTP_HOST))/faq/unavailable
ErrorDocument 403 http://((GET HTTP_HOST))/faq/unavailable


RewriteEngine on
RewriteCond %{HTTP_HOST} ^HTTP_HOST$ [NC]
RewriteRule ^(.*)$ http://HTTP_HOST/$1 [R=301,L]


Similar to the below

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.host\.com$
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^www\.([^.]+)\.host\.com(.*)


I hope that makes sense for someone to help me and thank you in advance.

Cheers,
Joe Very Happy
 Topic: [L] and [S=n] tags not working
[L] and [S=n] tags not working [message #2076] Thu, 06 January 2011 05:35
info@webvalue.com.au  is currently offline info@webvalue.com.au
Messages: 1
Registered: January 2011
I'm trying to get the second rule to not run if the conditions in the first rule are met.

I've tested the first rule on it's own and it does detect my string ending in gigs and rewrites the link as the home link, but when I add the second rule, it runs as well even though, presumably the first rule is still matching the initial string!

Funny thing is that when I remove "gigs" from the first rule and just have ^(.+)$ instead of ^(.+)gigs$, then the L tag does prevent the second rule from running.

Please tell me how to prevent the second rule from running if the first rule is ^(.+)gigs$. Oh yeah, I get exactly the same reactions if I use [S=1] instead of [L].

RewriteCond %{HTTP_HOST} ^davos(.+)$ [NC]
RewriteRule ^(.+)gigs$ http://davos.karaoke.com.au/index.cfm/go/main.home [NC,L]

RewriteCond %{HTTP_HOST} ^davos(.+)$ [NC]
RewriteRule ^(.+)$ http://davos.karaoke.com.au/index.cfm/go/main.contact [NC,L]
 Topic: Problems with my 301 redirect
Problems with my 301 redirect [message #2071] Tue, 04 January 2011 11:52
navarra  is currently offline navarra
Messages: 1
Registered: January 2011
Hi all. During 1 week I asked a lot of people about how to redirect URL with %20 but I didn't find any answer. I need to redirect this URLs:

http://site.net/es/author/Temur Danelia/
http://site.net/author/Temur Danelia/

I tried a lot of things but didn't get solutions. Later I found this forum and hope here I will find the correct answer.

The thing is that on goolge webmaster tool due to this error I got more than 100 not found pages and my site everyday is losing ranking. I really need your help

Thanks
 Topic: redirecting through password and username
icon5.gif  redirecting through password and username [message #2070] Mon, 03 January 2011 20:29
next2  is currently offline next2
Messages: 1
Registered: January 2011
Hi,

Is there a possibility of switching the site by using the authentication. htpasswd file?

Thanks
 Topic: Re:rule rewriting
Re:rule rewriting [message #2069] Sat, 01 January 2011 07:22
Neha123  is currently offline Neha123
Messages: 1
Registered: January 2011
How do i write .htaccess rule to construct url with multiple parameters with values only
 Topic: 301 Redirect from plain static to confusing url
icon2.gif  301 Redirect from plain static to confusing url [message #2068] Tue, 28 December 2010 20:33
nathonhay  is currently offline nathonhay
Messages: 1
Registered: December 2010
I want to permanently 301 redirect http://www.thegolfstationfit.com and http://thegolfstationfit.com TO http://thegolfstation.retailtribe.com

Going to http://thegolfstation.retailtribe.com brings up
http://thegolfstation.retailtribe.com/pro/Default.aspx

My .htaccess file in the root of thegolfstationfit.com reads:
RedirectMatch 301 http://www.thegolfstationfit.com/(.*) http://thegolfstation.retailtribe.com//$1

and takes me to this page:
http://www.thegolfstationfit.com/Pro/ErrorPages/Maintenance. htm?aspxerrorpath=/pro/Default.aspx

What's going on? Do I need a special "rewrite" rule because I am forwarding to a .aspx file?

Thanks,
Nathon
 Topic: .htaccess allowing one file to have access to all others
.htaccess allowing one file to have access to all others [message #2066] Tue, 28 December 2010 17:34
armon  is currently offline armon
Messages: 1
Registered: December 2010
Location: POL
Hello,

Is that possible to write in .htaccess something that is allowing one file to have access to all others.

For example I start with

Order deny,allow
Deny from all


how to make for example file 'controller.php' to have access to all the files ?

I'd like to do in controller.php readfile('myvideo.flv'); at the end, but it won't work, because i didn't allow it by using the code i mentioned. I want to have only controller.php to have access for it.

Any ideas, please?
 Topic: redirect user profiles
redirect user profiles [message #2064] Mon, 27 December 2010 21:17
jasc2k  is currently offline jasc2k
Messages: 1
Registered: December 2010
hi all,

I do not have an intense knowledge of htaccess scripts and require some help with the following please:

RewriteRule ^profile/(.*)?$ index.php?id=userinfo&puser=$1


this is my revised attempt so if www.addr.com/profile/username
is entered the above redirection is handled. this actually works fine UNLESS www.addr.com/profile/username/ with a trailing slash is applied, can this be fixed?


below is my first attempt (which I beleive to be better?)
RewriteCond %{SCRIPT_FILENAME} !-d   
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^profile/([a-zA-Z0-9_]+)$ index.php?id=userinfo&puser=$1
RewriteRule ^profile/([a-zA-Z0-9_]+)/$ index.php?id=userinfo&puser=$1


this worked great EXCEPT this conflicted with my subdomain redirects mobile.addr.com stopped working, I tried to ignore any actual directories using the REWRITECOND with no luck?

Any help on either - muchly appreciated
thanks
 Topic: Please help with .htaccess domain change
Please help with .htaccess domain change [message #2063] Sun, 26 December 2010 23:38
dotbin  is currently offline dotbin
Messages: 1
Registered: December 2010
Hi

Please could someone help and let me know if the following is possible with htaccess.

I have a directory called

/images/

which holds a load of images. at present it redirects to a folder using php in the following directory

/images/zenphoto/

zenphoto is the php gallery software.

i want the

/images/zenphoto/

to look like

/images/

in the address bar but I don't want to rearrange my directory structure.

many thanks.
 Topic: 301 Redirect dynamic URL matching expression - please help
301 Redirect dynamic URL matching expression - please help [message #2059] Sun, 26 December 2010 14:05
natastna2  is currently offline natastna2
Messages: 1
Registered: December 2010
Hi guys. I've spent the last few hours trying to get my head around this problem. I've got a site using some translation software and it works for the most part but it cannot work in the checkout stages so I want to redirect the url it's creating www.mysite.com/nl/index.php?etc to www.mysite.com/index.php?etc

The URL I get atm is http://www.mysite.com/ja/index.php?p...ed=1&Itemid=65

and I would love to get http://www.mysite.com/index.php?page...ed=1&Itemid=65

I've been trying different combinations of things but I simply don't have the experience with mod rewrite, if anyone could point me in the right direction, I'd greatly appreciate it. Thanks for your time. Ant.
 Topic: RewriteRule "overwriting" other rewriterule
RewriteRule "overwriting" other rewriterule [message #2042] Wed, 15 December 2010 19:08
Sysgod  is currently offline Sysgod
Messages: 1
Registered: December 2010
Location: Argentina
Under this structure:
http://localhost/consultur/consultas/
I have the .htaccess file with the following code (is not the ONLY code, but the troubled one):

RewriteRule ^(.+)(/)([0-9]+)$ leer_consulta.php?id=$3 [NC]
RewriteRule ^responder/(.+)(/)([0-9]+)$ responder.php?id=$5 [NC]

The first RewriteRule works OK. Whenever a user clicks a link like:
http://localhost/consultur/consultas/Restaurante-en-Piriapol is/24
It goes to leer_consulta.php file

The problem is with the second RewriteRule.
When a user clicks a like like:
http://localhost/consultur/consultas/responder/Restaurante-e n-Piriapolis/24
It doesn't go to the responder.php file, instead, it doesn't do anything (or it goes to the same leer_consulta.php with the correct parameters).

This behavior maybe because both RewriteRules have the same structure: (.+)(/)([0-9]+)
But the second one has the "RESPONDER/"... so, it's not the same!

I was thinking on adding a RewriteCond... I tried a little (without much knowledge), and nothing worked.

The problem remains... clicking the responder link doesn't send the browser to responder.php


Any help, please.

Thank you.

Juan P.
 Topic: New domain, page specific redirects and all else to new root
New domain, page specific redirects and all else to new root [message #2035] Tue, 14 December 2010 11:23
fredrikp  is currently offline fredrikp
Messages: 1
Registered: December 2010
Location: Stockholm
Hello,

For the first time I am about to redirect a site to a new domain. It is a small, five-page site, but still I run into problems. I would like to make 301 redirects for all pages that have a good equivalent page in the new site and for all other traffic use whatever redirect that is advisable.

The flow would be something like this

/ --> http://www.new.com/
/page1/ --> http://www.new.com/page1/
/page2/ --> http://www.new.com/somethingDifferent

all other traffic --> http://www.new.com/

Another possibility for the "all other traffic" would be to replicate whatever comes after the root and let the new server do the error handling. Like this

/*** --> http://www.new.com/***

which would cause a 404 error.

Help, tips and hints would be much appreciated!

//Fredrik
 Topic: htaccess help with directory protect and wordpress
htaccess help with directory protect and wordpress [message #2034] Tue, 14 December 2010 01:45
dhascup  is currently offline dhascup
Messages: 1
Registered: December 2010
I am having a problem with a website. I am converting over to wordpress. However, this make the .htaccess file within the public_html change. By doing so, my public_html/aa_darts/password folder, which has a directory protect with passwords comes up as Page No Longer Exists. What do I need to change in either htaccess file to make this work again?

NEW htaccess file in public_html
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /new/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /new/index.php [L]
</IfModule>

# END WordPress


OLD htaccess file in public_html
<Limit GET POST>order deny,allowdeny from allallow from all</Limit><Limit PUT DELETE>order deny,allowdeny from all</Limit>RewriteEngine onRewriteCond %{HTTP_HOST} ^.*$RewriteRule ^aa_darts/forum/?(.*)$ "http\:\/\/www\.website\.com\/forum\/$1" [R=301,L]AuthName website.comIndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*php_value memory_limit 32M


Current htaccess file in public_html/aa_darts/password folder
AuthUserFile "/home/website/.htpasswds/public_html/aa_darts/password/passwd"
AuthName "password"
AuthType Basic
require valid-user
 Topic: Rewrite all except the map itself
icon4.gif  Rewrite all except the map itself [message #2032] Sun, 12 December 2010 18:47
wwwesley  is currently offline wwwesley
Messages: 1
Registered: December 2010
Hello,

Recently i started rewriting urls for seo purposes. My .htaccess looks like this:

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/artiesten/artiest\.php
#RewriteCond %{REQUEST_URI} !^/artiesten/$
#RewriteCond %{REQUEST_URI} !^/artiesten$
RewriteRule ^/?artiesten/([^/]+)/?$ /artiesten/artiest\.php?id=$1


I want /artiesten/jan-smit/ to be rewritten to /artiesten/artiest.php?id=jan-smit, but I don't want that /artiesten/ is rewritten to /artiesten/artiest.php?id= .

This works except for the last part. I tried excluding it by adding the commented conditions, but no result. I think that my regular expression of the rewrite rule shouldn't except /artiesten/ , but it does!

Any help? Thank you!

[Updated on: Sun, 12 December 2010 18:57]

Pages (28): [ «    1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16    »]


Current Time: Thu May 17 07:50:59 CEST 2012

Powered by: FUDforum 3.0.0.
Copyright ©2001-2009 FUDforum Bulletin Board Software