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

Forum: Htaccess Questions
 Topic: redirect based on case
redirect based on case [message #1714] Thu, 04 March 2010 02:43
kpimichael  is currently offline 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 Smile
 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  is currently offline 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  is currently offline 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  is currently offline jsweb
Messages: 1
Registered: February 2010
Morning all (it's a sunny Friday here in Ireland Wink

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
.htaccess file for an escorts directory [message #1702] Thu, 18 February 2010 18:34
ursinho  is currently offline ursinho
Messages: 1
Registered: February 2010
Hello,
i found this forum searching in google help to .htaccess configuration. So i hope you can help me.
I have an escorts directory script running by Godaddy Linux Hosting Service (mod_rewrite enabled) and in the script configuration panel i can select if i what use standard urls or search engine friendly urls with a second option to choose (-) separator or (+) separator and an advise if i use (-) separator i must use 2.5 .htaccess rules.
I tried to use an online .htaccess generator tool to create my .htaccess but after i uploaded the created .htaccess file to my web space, selected to use search engine friendly urls and visit a listing page, the browser shows a search engine friendly url but a 404 error page appears.
I noted that the generated search engine friendly urls always starts with the word "listing" ex.:

1) Search Engine Friendly Url and (+) separator option

http://www.mywebsite.com/listing-city+firstword+age+yo+secon dword+thirdword+fourthword+fifthword-4.html

404 Error Page Appears!


2) Search Engine Friendly Url and (-) separator option

http://www.mywebsite.com/listing-city-firstword-age-yo-secon dword-thirdword-fourthword-fifthword-4.html

404 Error Page Appears!


3) Standard Url

http://www.mywebsite.com/index.php?action=listingview&li stingID=4

Listing is showed correctly but as you can see the url is not search engine friendly! Sad

I hope you can help me to solve this problem and excuse me if i disturbed you with it

Thanks so much for your attention

[Updated on: Thu, 18 February 2010 18:38]

 Topic: htaccess and the likes
htaccess and the likes [message #1700] Thu, 18 February 2010 12:49
datastreams  is currently offline 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  is currently offline 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?
icon5.gif  htaccess config to require authentication for all except for these URLs? [message #1696] Tue, 16 February 2010 02:25
callagga  is currently offline 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  is currently offline 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
301 redirect - find and replace [message #1688] Sun, 31 January 2010 18:19
Chrome Orange  is currently offline Chrome Orange
Messages: 1
Registered: January 2010
Hi all

I am trying to standardize the URLs that have been generated via joomla

http://www.domain.com/index.php/en/news/article.html
http://www.domain.com/index.php/fr/news/article.html
http://www.domain.com/en/news/article.html
http://www.domain.com/fr/news/article.html

are examples of URLs that have been added to articles etc (don't ask, I'm joining this project after a lot of articles have been written)

I want to end up with

http://www.domain.com/news/article.html
http://www.domain.com/fr/news/article.html

news/article.html is variable

thanks in advance.


 Topic: exclude rewrite query string
exclude rewrite query string [message #1687] Sat, 30 January 2010 20:04
damiantaylor  is currently offline 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 Sad
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 Embarassed
 Topic: 301 redirect question
301 redirect question [message #1686] Thu, 28 January 2010 17:34
cssites  is currently offline cssites
Messages: 1
Registered: January 2010
I recently moved a site from Movable Type to WordPress. I kept the same directory structure for all the pages, including converting the - that WordPress uses to the _ that MT uses. My concern is that all the pages created via MT have the .php extension on them whereas the WP pages do not.

Is there a way that I can do a quick Rewrite rule in .htaccess that can redirect the .php extensions to the non extended pages without me having to add each page 301 rule individually? I want to be sure that if someone has bookmarked the page, that they'll be redirected to the correct page on the site.

Example:
If people go to
http://www.domainname.com/patient_education/disease_treatmen t/hormone_replacement_therapy.php
I need the to be automatically redirected to
http://www.domainname.com/patient_education/disease_treatmen t/hormone_replacement_therapy/

Just checking to see if there was an easier way of doing this than manually redirecting 35 pages and 30 posts. Smile

Thanks!

~ Jenn McGroary
 Topic: Htaccess and Tumblr
Htaccess and Tumblr [message #1684] Thu, 28 January 2010 04:56
ducki  is currently offline 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?
Rewrite Forward? [message #1680] Sun, 24 January 2010 13:46
wwfc_barmy_army  is currently offline wwfc_barmy_army
Messages: 1
Registered: January 2010
I will be changing domain shortly. The site will be transferred so only the domain name will change in the url. I need to do a 301 Redirect to help google keep up with the process too.

I need it so if someone goes to:
http://myolddomain.com/ it goes to http://mynewdomain.com/
http://myolddomain.com/arewrite -> http://mynewdomain.com/arewrite
http://myolddomain.com/another -> http://mynewdomain.com/another
etc

Is there an easy rewrite to do this?

Thanks guys.
 Topic: htaccess redirect
htaccess redirect [message #1679] Fri, 22 January 2010 13:00
almond  is currently offline 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
Pages (17): [1  2  3  4  5  6  7  8  9  10  11  12  13  14  15    »]


Current Time: Thu Mar 11 12:43:27 CET 2010

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