.htaccess

list contents of on-line folder with restricted access (and how to prevent this)

Hi all: I restricted access to my Internet folder, e.g. http://www.my-domain/my_folder/my_sub_folder/ So that, for anybody access is denied (403 Forbidden message) If I provide someone with a direct link to one of the folder's files, it is possible to access it from anywhere on the Internet, e.g. http://www.my-domain/my_folder/my_s...

Redirecting all uri's to script possibly with htaccess

I am trying to design a small site where most of (95%) of site assets will be passed through home sort of PHP script, and the remaining 5% are being hosted from a subdomain (background images, logos, etc. What I would like is that whenever a page is called, say www.example.com/blog/My_trip_to_the_andes the page that would be called is h...

mod_rewrite params inversion

How can I create the mod_rewrite rule so I can convert the following URLs: From: domain/something/param/action ex:domain/cities/Chicago/view to: domain/something/action.php?param1=param ex: domain/cities/view.php?city=Chicago Changing to cities/view/Chicago cannot be an alternative. Thanks in advance. ...

htaccess rewrite not working for all rules

This is a very strange problem, and I just hope that I can clearly explain it. Basically, we made a major update on a client site today, and needed to update some rewrite rules in the htaccess to accomodate the new structure, etc... So, where we originally had things like: RewriteRule ^/resources/?$ index.php?id=resources RewriteRule...

.htaccess subdomains

Hallo all. i want to create a .htaccess file if i type subdomain.domain.com can i use ( subdomain ) as a query string and domain.com like domain. can i get help to this? :) tanks ...

htaccess rewrite and auth conflict

I have 2 directories each with a .htaccess file: html/.htaccess - There is a rewrite in this file to send almost everything to url.php RewriteCond %{REQUEST_URI} !(exported/?|\.(php|gif|jpe?g|png|css|js|pdf|doc|xml|ico))$ RewriteRule (.*)$ /url.php [L] and html/exported/.htaccess AuthType Basic AuthName "exported" AuthUserFile "/hom...

Htaccess file gets ignored (while trying to double-secure Plesk)

I'm a beginner running 1&1's default customer-self-manages Apache setup, which has Plesk pre-installed. The Plesk site is at https://example.com:8443/ (where example.com is my registered domain) and brings up a PHP-based login page. However, I'd like to additionally secure this app with an htaccess, HTTP-based authentication request (bec...

Enable the "redeclare" for PHP5, with .htaccess or php.ini

Hi friends, serious problem with an angry client :( i have an issue about "Cannot redeclare variable" etc. i had a website working on PHP4 then moved to PHP5 and i have this error: Fatal error: Cannot redeclare CSQLAdmin::$functions in /blabla/lib/sqladmin.php on line 45 I tried to clear the second declaration at the file, and it fi...

RedirectMatch 301 Wildcards Without Variables at the End

How do You do a re-direct a group of pages with a wildcard that doesn't attach the variables at the end? For example, the .htaccess code below: RedirectMatch 301 /general/old_events_page.php(.*) http://mysite.org/events Yields this: mysite.org/events?id=749&friendly=1&date=20090308 But I just want it to go to http://mysite.org/event...

Access-Control-Allow-Origin Multiple Origin Domains?

Is there a way to allow multiple cross-domains using the Access-Control-Allow-Origin header? I'm aware of the *, but it is too open. I really want to allow just a couple domains. As an example, something like this: Access-Control-Allow-Origin: http://domain1.com, http://domain2.com I have tried the above code but it doesn't seem to ...

How can I make the URL search engine friendly?

I want to cahange mysite.com/profile.php into mysite.com/profile I wrote the htacess file as RewriteEngine On RewriteRule ^profile/?$ profile.php [NC,L] and placed in root directory. It doesn't work. I use the apache server. What is wrong with my program? ...

.htaccess / https redirection, virtual folder access with exceptions

/* THIS would appear to be a duplicate of another question I had asked 10 days back (http://stackoverflow.com/questions/1601876/htaccess-redirecting-to-https-www-mydomain-com-and-virtual-folder-access), but (a) I didnt get any responses to the changes I made to the question, and (b) this question here is a more complex version of the abo...

Mod_rewrite-multiple pages

Hi guys I have two URLs that I would like to rewrite: /artist.php?name=x => /x /albums.php?title=y => /y This is what I put in the .htaccess file: RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)$ artist.php?name=$1 RewriteRule ^([a-zA-Z0-9_-]+)/$ artist.php?name=$1 RewriteRule ^([a-zA-Z0-9_-]+)$ albums.php?name=$1 RewriteRule ^([a-...

url rewriting slows down proxy a lot

i have a proxy script which writes very ugly long URL. the proxy script automaticaly rewrites all href links with long ugly URL, mysite.com/proxy.php?url=somesite.com mysite.com/proxy.php?url=somesite.com/somedir mysite.com/proxy.php?url=somesite.com/somedir/somepage.php to fix this i have done 2 things edit the proxy script so that...

How to change htaccess to redirect all non-www links to www pages?

How can I redirect all non-www links to www links? I have found solutions on the internet, but they only redirect the domain name. How do I make this general: http://example.com/testing should redirect to http://www.example.com/testing ...

URL Rewriting Help

I'm trying to learn Regex & URL Rewriting in PHP. How can I create an .htaccess file which will rewrite (not redirect) any url to index.php?q={url}? For example: http://www.example.com/baloon to http://www.example.com/index.php?q=baloon I tried: RewriteEngine On RewriteRule ^$ index.php?q=$1 [R] ...but it is not working...

htaccess redirecting issue

My current .htaccess: <IfModule mod_rewrite.c> # Turn on URL rewriting RewriteEngine On # Put your installation directory here: # If your URL is www.example.com/, use / # If your URL is www.example.com/kohana/, use /kohana/ RewriteBase / # Do not enable rewriting for files or directories that exist RewriteCond %{REQUEST_FILENAME} !-f ...

How to redirect based on Accept-Language with Apache / mod_rewrite

For language redirects we currently create folders in the web root containing an index.php file which checks the HTTP_ACCEPT_LANG server variable. e.g. for the url www.example.com/press/ in /var/www/site/press/index.php: <?php if ($_SERVER["HTTP_ACCEPT_LANGUAGE"] == "en") header("location: ../press_en.php"); else header("l...

How to redirect requests to example.com to www.example.com with mod_rewrite?

This is my .htaccess generated by wordpress that sits in my root directory. I need to modify/add to it, to direct all incoming traffic to www.example.com, instead of example.com. # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ...

Add Trailing Slash to URLs

There are quite a few results for add trailing slash .htaccess on Google, but all examples I found require the use of your domain name, as in this example: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !example.php RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ http://domain.com/$1/...