| Forum: Htaccess Questions |
|---|
| Topic: redirect based on case |
|---|
| redirect based on case [message #1714] |
Thu, 04 March 2010 02:43 |
kpimichael Messages: 1 Registered: March 2010 |
|
|
|
I have a directory called frogpond i want to make sure that users can get to it if they put in FROGPOND or FrogPond in the url.
For instance. http://mywebsite.com/FROGPOND.... or
http://mywebsite.com/FrogPond....
I want it to go to http://mywebsite.com/frogpond/.....
It seems simple enough and i have tried several variations...but i never get it to work... and i get no errors...
Here is the code that i put in at the root level of the domain.
## This just makes sure that if anyone
## tries to access a directory by upper or lower case
## that they can get to it. Make sure the real directory
## is in lowercase
RewriteEngine On
Options +FollowSymlinks
RewriteRule ^FROGPOND http://mysite.com/frogpond/from.html
RewriteRule ^FrogPond http://mysite.com/frogpond/from.html
Any ideas on what i am doing wrong or how it could be done right
|
|
|
| Topic: Redirec to parrent directory without using web address |
|---|
| Redirec to parrent directory without using web address [message #1706] |
Sat, 20 February 2010 01:34 |
Shadow Messages: 1 Registered: February 2010 |
|
|
|
|
I'm trying to redirect a directory to the main index (which is in a sub dir already). I have tried a few differant things but nothing has worked. Like I said I dont want to use my domain, int he script. I have tried using the html ../ but that doesn't work. I guess if I have to, I can just use an html/php script and do it that way, but I would like to use htaccess instead. Any ideas?
|
|
|
| Topic: directory restricted but files are not |
|---|
| directory restricted but files are not [message #1705] |
Fri, 19 February 2010 22:17 |
pernest Messages: 1 Registered: February 2010 |
|
|
|
Hello
I am new to using htaccess. I have got so far with my host but now I have run into an 'interesting' problem.
I've managed to restrict a directory which contains two test files index.php and test.php. When I try to access the directory itself I'm prompted for a username and password, if I enter the correct ones then index.php loads. However if I try and access either index.php or test.php then I am allowed to without any restriction.
.htaccess is
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /web2/user7423/website/learning/testing/.htpasswd
AuthGroupFile /dev/null
require valid-user
I know that I'm not supposed to have the .htpasswd file in my web directory but I'm taking this one step at a time. I want to get it working first before I use best practice.
I am using a very restrictive package on the host easily.co.uk, basically I have ftp access and nothing else.
If anyone has any ideas they would be much appreciated.
Paul
[Updated on: Fri, 19 February 2010 22:31]
|
|
|
| Topic: Folder protection for php |
|---|
| Folder protection for php [message #1703] |
Fri, 19 February 2010 11:37 |
jsweb Messages: 1 Registered: February 2010 |
|
|
|
Morning all (it's a sunny Friday here in Ireland 
We are using an editor (FckEditor) which has a function to allow you to UPLOAD files to a set folder e.g. /images/
This folder needs to be 777 to allow the fckeditor to browse it and upload images.
However, want to add a .htaccess file into that folder so that via a URL to that folder http://www.domain.com/images/ that any .php files cannot be run.
If we add a standard:
<Files *.php>
Order Deny,Allow
Deny from all
</Files>
It stops the fckeditor browser working (which we still want to allow)....
We're a bit stuck and any suggestions would be appreciated.
Thanks
|
|
|
| Topic: .htaccess file for an escorts directory |
|---|
|
| Topic: htaccess and the likes |
|---|
| htaccess and the likes [message #1700] |
Thu, 18 February 2010 12:49 |
datastreams Messages: 1 Registered: February 2010 Location: coventry |
|
|
|
i have set a site up, with some photos of people, but i'm a little confused on restricing access, so i need a little assistance on this if anyone could help me out i'd appreciate it.
I have a site set up that contains a home page, from there you can select a porttriats page, what i want to do for example is have a seperate page set up with the the list of names whos photos i have taken, where you can select your given name, then you will be prompted for your password before allowing you to see them.
so i have setup like so,
www.myphotos.com from there you select your portraits page, but its here i want to add a list of names, but this is wehre i'm stuck as i've never used this htaccess before so how is the best way to go about this, i'd appreciate the very bacics on how i go about this please.
many thanks all.
|
|
|
| Topic: redirect from domain.com/sub/(anyname) |
|---|
| redirect from domain.com/sub/(anyname) [message #1698] |
Wed, 17 February 2010 21:00 |
ryan_82_bentley Messages: 1 Registered: February 2010 |
|
|
|
I am working on a project were I am going make and send over 1000 postcards for a business and would like to post a form online for them to fill out. Everyone will go to the same index.html in a subdirectory but we want to make them fill special by typing in
www.mydomain.com/sub/JohnSmith(any name)
my htaccess would redirect that or whatever they type into that "JohnSmith" area to www.mydomain.com/sub/index.html
I AM VERY NEW AT HTACCESS!
Here is what I have came up with so far, which by the way does not work what so ever ( I get a 500 error.)
Redirect ^([A-Za-z]+)$ http://domain.com/sub/index.shtml [NC,L]
Thanks
[Updated on: Wed, 17 February 2010 21:24]
|
|
|
| Topic: htaccess config to require authentication for all except for these URLs? |
|---|
htaccess config to require authentication for all except for these URLs? [message #1696] |
Tue, 16 February 2010 02:25 |
callagga Messages: 1 Registered: February 2010 |
|
|
|
Hi,
What is the htaccess lines/config I would require to ensure that all parts of my site (files & URLs) are protected by authentication, EXCEPT for a given limited set of URLs. For example all except "/api/.*" if this makes sense.
The actually authentication could be like the below, but it's how I wrap this in the directives...
AuthName "Dialog prompt"
AuthType Basic
AuthUserFile /home/callagga/site/.htpasswd
Require valid-user
thanks
|
|
|
| Topic: low level 301 redirection |
|---|
| low level 301 redirection [message #1690] |
Mon, 08 February 2010 09:47 |
kzar99 Messages: 1 Registered: February 2010 Location: Athens, Greece |
|
|
|
Although it should be simple enough (at first),it is becoming a nightmare for me (no great experience with mod_rewrite).
The site i working on is mostly a static one and been trying to create a dynamic one, based on existing urls
At root level htaccess i have a simple rewrite rule (RULE1) like this:
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/([^-]+)-foo-([^.]+).htm$ some_folder/php_page.php?var1=$1&var2=$2&var3=$3& ;var4=$4&var5=$5 [nc]
This creates urls like:
folder1/fodler2/folder3/page-foo-1.htm
Now consider this:
- folder1/folder2 are major categories with thousands of sub-pages in them
- there could be thousands of 301 redirection rules for this combo (folder1/folder2) (since many old htm pages will be transformed into php ones, either simple rewritte page.php into page.htm OR new url page-1.htm out of page.htm for paginaton)
I was thinking of making small htaccess in folder1/folder2 level and put there all rules for that combination of folders. That way, I thought it will be easier to maintaining and check my rules.
But i havent been able to make this work.
This is the htaccess of folder1/folder2 so far:
RewriteEngine on
RewriteBase /folder1/folder2/
RewriteRule ^folder3/page-foo.htm$ folder3/page-foo-1.htm [R=301]
This gives me a 'page not found' error.
Searching some more I found a different solution I could follow.
Put all rules in root htaceess and group them like:
RewriteRule !^folder1/folder2/ - [S=100]
RewriteRule ^folder3/some-page1\.htm$ http://www.example.com/folder1/folder2/folder3/some-other-pa ge-1.htm [R=301,L]
If i understand this correclty it says something like:
If requested url do not start with folder1/folder2, ignore else proccess the 100 rules below.
I want to ask on differences on my two approaches (taking into account that in the end i will have nearly 65 thousands redirections/rewtitting rules).
Also, why the first approache fails?
Thank you for any advice tips
|
|
|
| Topic: 301 redirect - find and replace |
|---|
|
| Topic: exclude rewrite query string |
|---|
| exclude rewrite query string [message #1687] |
Sat, 30 January 2010 20:04 |
damiantaylor Messages: 1 Registered: January 2010 |
|
|
|
Hi, I'm just learning about rewrite and have a question....
I have the following line in my .htaccess file to redirect anything that uses file index.php
RewriteRule (.*) index.php?%{QUERY_STRING} [L]
This works great, too great in fact!
I have 2 possible links from my site that go to the same page.
They are
/index.php?products_id=84
/index.php?products_id=84:123456789
Is there any way to make the first link go through the rewrite, but exclude the second link?
I tried RewriteRule (.*) index.php?%{QUERY_STRING} !*products_id*:* [L]
But it didn't work
What I was trying to say was 'process any request to index.php except anything that has products_id AND : in the query string.
Can you tell me if this is possible, or if there is a better way of achieving what I'm after?
Thanks for your help.
I'm trying to learn the syntax but am struggling
|
|
|
| Topic: 301 redirect question |
|---|
|
| Topic: Htaccess and Tumblr |
|---|
| Htaccess and Tumblr [message #1684] |
Thu, 28 January 2010 04:56 |
ducki Messages: 1 Registered: January 2010 |
|
|
|
Obviously, I'm new to this. Call me a n00b, whatever. But I was just wondering (if anyone here knows what Tumblr is...) if there was there a way I can put htaccess on my blog to block an IP Address?
Thanks guys!
|
|
|
| Topic: Rewrite Forward? |
|---|
|
| Topic: htaccess redirect |
|---|
| htaccess redirect [message #1679] |
Fri, 22 January 2010 13:00 |
almond Messages: 1 Registered: January 2010 Location: Lithuania |
|
|
|
Hi,
i'm a noob in htaccess coding, so could you help me
i am trying to add a slash at the end of a given url.
how can i redirect url for example
http://site.example.com/cms to http://site.example.com/cms/
also cms is a directory, so i need a rewrite rule, which indicates that if ther's no other characters it will redirect.
http://site.example.com/cms - Redirect
http://site.example.com/cms/asd - Dont redirect
my htaccess code is :
# Turn on URL rewriting
RewriteEngine On
RewriteBase /
# Protect application and system files from being viewed
RewriteRule ^(libs|modules) - [F,L]
#here should be redirect
RewriteCond %{REQUEST_FILENAME} /cms$ [NC]
RewriteRule ^(.*)$ http://site.example.lt/cms/ [R,L]
#redirect end
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
# Rewrite all other URLs to index.php/URL
RewriteRule .* /index.php?cms=1&url=$0 [PT,L]
Thanks
|
|
|