.htaccess

Simple htaccess rules for clean URLs not showing static media

After looking at 4-5 different ways to get simple clean URLs for static files, we found one that was simple and easy to implement/maintain over multiple folder and files. One problem, it wont load the js/css/images from that folder it is looking at. Here is the rule - it loads the html ok, but not the images, etc which are in the /ima...

Difficulties with .htaccess and Blocking Specific File Extensions

Hey all, I have a rather complicated situation where I run a personal blog where every Friday and Sunday, I will post up music on the blog by uploading the mp3s into a folder, where a Flash mp3 player accesses it and plays it for the world. Recently, some website called Dizzler, which is like a spider for mp3 files (Like the ones I hos...

.htaccess and page names.

I have a fairly massive web site for which I need to modify the names of the files shown in the URL. I am using Apache 2 with mod_rewrite enabled. I currently have the following configuration in my .htaccess file: RewriteEngine on RewriteBase / RewriteRule ^CakeList\.php$ TastyThingsList.php [T=application/x-httpd-php] Now, when I a...

redirect non-index page requests to hash links with .htaccess

i'm weak in regular expressions, i need to redirect any FileName.htm or FileName.html page request to ./#FileName, only if the request is incoming from an outside link. These files will all reside in the root directory. this is what i have so far. it gives me errors : ( RewriteCond %{REQUEST_FILENAME} !index.html$|!index.htm$ [NC] Rew...

downloading a file from a web directory

hi. i have a form which allows the user to upload some files to a folder. i've edit the .htaccess file in that directory to protect this folder from allowing the unwanted visitors to download the contents manually by typing the full url ex: http://www.bkabkabka.com/a/b/c/document.pdf and this is the .htaccess data Options All -Indexe...

How to use HTTP Authentication with PHP and then run the entered data against a database?

Creating simple php login scripts is easy, with simple one table mysql integration. I was wondering how i could you the rather snazzy HTTP Authentication that is available in HT Access and PHP, but the users are checked against a mysql database? I am sure this is possible, but i have no idea how :/ ...

Zend and .htaccess

My default 'zend' app has this default structure /zend + webroot /application /config /library /public .htaccess index.php and the default .htaccess redirects the various controller/action details via ./public/index.php RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILE...

How would I convert my .htaccess file to NGINX?

How would I convert my below .htaccess (Apache) file so that it could be used by NGINX? Options -Indexes Options +FollowSymLinks # Enable ETag #FileETag MTime Size FileETag none # Set expiration header ExpiresActive on ExpiresDefault A2592000 Header append Cache-Control "public" # Compress some text file types AddOutputFilterByType D...

Allow subdirectory in htaccess

Hi there, I have a directory structure like so: directory1 - directory2 - <other files I want to be hidden> I want to allow the user access to directory 2, but disallow access to directory 1. For example: http://website/directory1 = 404 / Forbidden http://website/directory2 = Routes to directory1/directory2 and shows files. I mana...

How to use getenv() in php and SetEnv in a .htaccess with a compiled php-cgi on a shared host

Just putting in context to clarify the main question: On my development machine, PHP5.3.1 is installed on Apache as a module, I use SetEnv APPLICATION_ENVIRONMENT development in my application's root .htaccess file. It is then easily retrievable from any php script with getenv('APPLICATION_ENVIRONMENT'). On the production server, on a ...

.htaccess redirect all files in one folder to exact same in another folder

We simply have to move every page inside of a directory called "Music" to a directory called "Information"... That's the only change. There's lots of links to pages music and we don't want to break them all. I'm not great at rewrite conditions.... Basically, all I want to do is when a user types in music/index.php, for example, or musi...

.htaccess redirect request not index.php

I have a setup like this http://www.example.com/reroute/index.php. I would like to send all request not to index.php to index.php. So anything to /reroute/products would go to /reroute/index.php and would display http://www.example.com/reroute to the browser. It seems simple enough but every thing I have tried either tells me file doesn...

Redirecting /media/* to /project/media/* and everything else to /dispatch.php

I have the following rewrite rules: <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / # Route requests to /media/* to /projects/media/* RewriteRule ^media/.* - [NC,L] # Route all URLs to dispatch.php. RewriteRule ^(.*)$ dispatch.php [L] </IfModule> This redirects everything to dispatch.php, unless the URL is exampl...

php and htaccess

In the .htaccess file can we change the file extention to be display. Like my .htacces file rewrite any .html files to .php fileS WITH THE BELOW CODE. RewriteEngine On RewriteRule (.*).html$ $1.php [L] If the URL typed as http://localhost/test/test.html it will internally called test.php file. However I would like the page to have th...

Rewrite rules showing in location bar of browser.

I have the following rewrite rules: <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / # Route all URLs to dispatch.php. RewriteCond %{REQUEST_URI} !media/ RewriteRule ^(.*)$ dispatch.php [L] #Route requests to /media/* to /project/media/* RewriteRule ^media/(.*)?$ project/media/$1 [L] </IfModule> Everything is r...

Can someone please tell me why this regex pattern does nt match?

I have several sites listed in my htaccess file that I want banned but apparently, they are not being matched. I'm wondering if someone can tell me what I'm doing wrong. I have seen many tuts and all of them differ in one way or another so there is no way for me to know which way is the correct way. This is the condition (one of them) i...

htaccess redirect for non-www both http and https

Not sure if this is possible in a single .htacess file, but ideally, I'd like to have: http://example.com redirect to: http://www.example.com https://example.com redirect to: https://www.example.com And anything that is http://whatever.example.com NOT append the www like http://www.whatever.example.com. Is this possible? Thanks, D....

Wordpress subfolder needs .htaccess redirects and whitelist

Background: I have a site that displays songs with the Post structure of .com/song/foo.html I am adding every song to an additional child category called "private" that uses a different template (inserts premium content in custom fields), so the structure of the private versions of the Posts will be .com/song/private/foo.html. Question...

.htaccess, proper rewriting of directory and file with same name

As of now my website has a few static pages, one of which is /portfolio. Among other things, my htaccess hides the .html extension. I'd like to add a portfolio directory, but I do not want to move my existing portfolio page into the portfolio directory as the default index file. My /portfolio page is one of my Google sitelinks and I am...

php .htaccess rewrite with new cpanel account

I have the following in my .htaccess file, which I do often for cleaner URL's. There are pro's and cons to this I know and I think I've found a con. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php Options All -Indexes I've up a new cPanel account for this websit...