.htaccess

.htaccess question : Can I strip out a leading question mark?

Hi, I have a page that already has the $_GET array initialized, and when a page redirects there (with an oAuth token) it appends the ?token=36264747 to the end. Is there a way to write an .htaccess file for an Apache server that would either strip that question mark or (better) replace it with an ampersand? ...

htaccess conditions + url rewrite

Currently, I have the setup in my htaccess so that example.com/dept/noc goes to: example.com/index.php?dept=dept&n=noc using RewriteEngine On RewriteRule ^([A-Za-z]+)/([A-Za-z]+)$ index.php?dept=$1&n=$2 [QSA] RewriteCond %{SERVER_PORT} 80 I have a folder called upload, how would I ensure that url rewriting is not in effect (an excepti...

CodeIgniter Backend Frontend .htaccess router

Hi, I'm trying to develop a little base CMS with CodeIgniter for my own use on projects but got stuck on this. Also, I'm very new to CI, but got some years with ZF and OOP PHP. First of all let me show you my file structure: index.php (frontend bootstrap) backend.php (backend bootstrap) .htaccess system ( CI core ) application backe...

Delete htaccess credentials in Safari

I have an app that logs in via .htaccess. When the person wants to logout, I use: function logout2() { try{ var agt=navigator.userAgent.toLowerCase(); if (agt.indexOf("msie") != -1) { // IE clear HTTP Authentication document.execCommand("ClearAuthenticationCache"); } else { var xmlhttp = createXMLObject(); xmlht...

301 Redirects on old content with new cakephp site

I am updating an old asp site to cakephp - the old site has various listings on google based on the old "filename.asp" urls - I'd like to put Redirect 301s in the htaccess file to try and hang on to those search results (most of the pages have a complementing page on the new site), but something appears to be going wrong. htaccess as fol...

Regular expression with RedirectMatch does anything

Hi I use .htaccess to perform redirection. Here the line RedirectMatch permanent .*\?langue=([\w]{2}).*id_([\w]+)=([1-9]+) ***[protocol]***://myserver/rootContext/action?pagename=dir1/dir2/dir3/Redirect&type=$2&id=$3&lang=$1 Here my inital url: ***[protocol]***://localhost/adir/anotherDir/anotherDirAgian/oneMore/apage.php?langue=fr...

Redirect only HTML files?

Part One I want to .htaccess redirect all HTML files to the home page. I looked at this guy's question (http://bit.ly/3l9K86), and wrote this code: RewriteCond %{HTTP_HOST} ^pandamonia.us$ [OR] RewriteCond %{HTTP_HOST} ^www.pandamonia.us$ RewriteRule .*\.html$ "http\:\/\/pandamonia\.us\/" [L] but the problem is that it also redir...

.htaccess set phtml to be run as php

Hi, I'm using this: AddHandler application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml ...within a .htaccess file but my .phtml files are not running as php, they're just showing the code! Have I missed something? ...

URL redirection added to .htaccess

Can anyone help me with adding the redirect rules to my .htaccess? I want to redirect websites visitors based on the URL they enter. For example: If a visitor enters URL without www to be redirected to my root (index.php) If a visitor enters URL, but with the WWW to be redirected to http://domain.com/home/index.html Edit: From your...

.htaccess or httpd.conf

I need to do a url-rewriting job now. I don't know whether I should put the code into a .htaccess or httpd.conf? EDIT What's the effecting range of .htaccess?Will it affect all requests or only requests to the specific directory it's located? ...

Can I protect with a .htaccess file some routes with sinatra?

I wrote a small app with Sinatra and have some admin routes (/admin/new, admin/edit/2, ...) and want to protect them with a .htaccess prompt. Can somebody tell me how I do that? ...

Apache folder protection methods vs cookie & database query for protecting website content and managing access rights. Which is best?

I am looking at user/subscription management software such as aMember Pro. This uses folder protection methods to prevent access to areas of the site. As such the PHP scripts require Apache (linux/unix). My webserver is IIS windows 2003 and I use a MySQL database to store user id and subscription status / access privileges. We really o...

Exclude htaccess for admin folder.

How to disable .htaccess for some folders? Example I want exclude htaccess for my admin folder Let me know.. ...

Disabling serving PHP files from a folder in .htaccess

I have a directory on server, from which I only want .JPG files to be served by apache - and apache should deny requests for php, php3, php5 etc files. What should I write in .htaccess? I have tried following, first two are giving 500 internal error, third one is not working at all! <Directory full-path-to/USERS> <FilesMatch "\.(php...

Impossible to mod_rewrite based on existence of file in mod_aliased directory?

I'm trying to do something like the following in my .htaccess file: Alias /assets /location/of/files RewriteCond %{REQUEST_URI} ^/assets/[0-9]+.jpg$ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule .* /build_thumbnail.cfm?path=%{REQUEST_URI} [QSA,L] So in theory it's quite straightforward: an image is requested from a url starting w...

301 Redirect Help with Dynamic URL's and Multiple Id's

Hello, I just did a redesign for www.wildchildclothes.com which has a new URL structure. The old site ran on Zen Cart and had a bad URL structure. Here are some examples of what I want to redirect from: OLD: www.wildchildclothes.com/page.html?chapter=1&id=21 NEW: www.wildchildclothes.com and... OLD: www.wildchildclothes.com/index.php...

Apache 400 Absolute Path for Blogs

Here is an example of a blog with this issue. It uses Apache to send a 400 error, but keep the url as is. Is there a way in Apache using a .htaccess file to keep the url as is so the PHP script can do as needed with it, but not send a 400 error? The site works fine in some browsers, but those like IE and mobile browsers have there own...

Directory structre change using .htaccess

I want to move all my web site files (even including index.php) into a subdirectory (for exp: "abc") For example BEFORE: public_html index.php a.file directory an.other.file ... AFTER: public_html abc_directory index.php a.file directory an.other.file ... I want everything to work, as it was before, but i ...

Is there a way to get the full contents of the address bar in php or htaccess?

Specifically. I am making an ajax app and trying to preserve the back button. My javascript is working properly and registering a new url in the address bar with an anchor-like hash in the url: http://t2b.localhost/#/clients/ I can catch the url when the page loads with javascript and load the "clients" page, but I want to know if ther...

Find all htaccess files on server

Hello, I'm looking for a Linux command to go through all the directories on my server and find all .htaccess files. The output would be a list of all those files with full path, creation/modification date and filesize. ...