.htaccess

Mod_Rewrite change GET value pairs into nice slashes.

I have a url http://domain.com/module/controller/action/get1/value1/?get2=value2&get3=value3 I want to use Mod_Rewrite to change the ?&= to appropriate / slashes inline with the first GET variable. I also need to avoid conflicts with my current Mod_Rewrite rules: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond ...

Help with mod_rewrite

Should request: site.ru/index.php?go=23&page=bla alter the form: bla.site.ru/index.php?go=23 That is, the user types in browser bla.site.ru/index.php?go=23 and all information is passed to scripts that request site.ru/index.php?go=23&page=bla It is prohibited to use redirect ...

What is the correct mod rewrite rule to use?

I have a website deployed on two hosts: one in the root path the other one in the sub path For example http://one.example.com/xyz => maps to /var/www/ http://two.example.com/subpath1/subpath2/ => maps to /var/www/subpath1/subpath2/ Now I want to permanently redirect abc.php to index.php on the hosts http://one.example.com/xyz/abc....

Trailing dots being stripped from URL

I've got a url - http://callisto/news/1st_February_is_here... - which has three trailing dots, but by the time it gets passed through mod_rewrite and reaches the script (in $_GET) the dots have been removed (but the rest of the string is OK). This is the htaccess rule: RewriteRule ^([^/]+)/(.*)$ index.php?__action=site&__filter=$1&__pa...

How do I switch between http and https in .htaccess?

I know this question has been asked several different ways and I've looked/tried many of the suggestions, but not getting anywhere. I have a site that's mixed http and https where everything /customer and /cart including any subdirectories are https and the rest is http. I'm having a problem with it actually going to https, seems as tho...

How to create an exception folder in a django site?

There are a few folders where I house my django site that I want to be rendered as it would on any other non-django site. Namely, forum (vbulletin) and cpanel. I currently run the site with fastcgi. My .htaccess looks like this: AddHandler application/x-httpd-php5 .htm AddHandler application/x-httpd-php5 .html AddHandler fastcgi-script ...

Drupal: how rewrite all urls so that the instal directory isn't included in the link

I installed drupal on my site at say, example.co.uk/portfolio. All the links are showing as example.co.uk/portfolio/project-1. I want it to be example.co.uk/project-1 How can I use rewrite rules or whatever so that wherever there is a link that has the /portfolio directory showing, that it will not show it in the href at all? I want t...

mod_rewrite question about modifying urls

I've finally got the mod_rewrite rule down somewhat, but would like to do a bit more with it and am not sure how. Here's what I currently have: RewriteRule ^rider/(.*)/(.*)*$ /bar/standings/rider.php?lnum=$1&short=$2 Which allows me to do this: http://pca.localhost/rider/214142/sme instead of http://pca.localhost/bar/standings/ride...

Redirecting to a diferent exe for download based on user agent

I own a Linux-Apache site where I host exe files for download. Now, when a user clicks this link to my site (published on another site): http://mysite.com/downloads/file.exe I need to dynamically check their user agent and redirect them to either http://mysite.com/downloads/file-1.exe or http://mysite.com/downloads/file-2.exe It seem...

How to ignore some directory in htpasswd ?

Hello ! I set some htaccess with htpasswd on my server. Here is it's content: Order Allow,Deny AuthType Basic AuthName "Password" AuthUserFile /var/www/.htpasswd Require valid-user Satisfy Any It works for all /var/www/* directories. Is it possible to ignore some of that /var/www/* directories ? ...

Conditional Directory Index In Htaccess

This relates to the question in: http://stackoverflow.com/questions/1599717/conditional-directoryindex-in-htaccess The answer states that the following should work: SetEnvIf Remote_Addr ^127\.0\.0\.0$ owner <IfDefine owner> DirectoryIndex index.html </IfDefine> <IfDefine !owner> DirectoryIndex index.php </IfDefine> I am not ...

RedirectMatch error with .htaccess

I have the following directive in my .htaccess file which works on one server, but not another: RedirectMatch hobby/RENDER/0001/2015/P2015.html$ http://www.escience.ca/hobby/RENDER/0001/2015/3035/W3035.html [L] On one of the servers, it gives me a 500 Internal Server Error. If I comment out the RedirectMatch, the 500 error goes away....

Help debugging Apache rewritebase/ rewrite rule

I try to access the following url on my site but get a 404 error: http://www.example.com/minify/1232681243/skin/frontend/default/default/css/boxes.css My path on the server is public_html/example My .htaccess file is as follows: RewriteBase / ############################################ ## workaround for HTTP authorization ## in CGI e...

How Do I Enter Multiple PHP Values in .htaccess?

Hi, I'm editing the .htaccess file in order to make some overwrites to my php.ini file (I don't have access to it). So far, I've added: php_value max_execution_time 600 php_value error_reporting E_WARNING php_value log_errors Off The application I'm editing for (vTiger CRM) recommends that "error_reporting" is set to "E_WARNING & ~E_...

.htaccess redirect root to subfolder

I would like mod_rewrite to redirect all requests to non existing files and folders, and all requests to the main folder ("root") to a subfolder. So i've set it up like this: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f [NC] RewriteCond %{REQUEST_FILENAME} !-d [NC,OR] RewriteCond %{REQUEST_URI} / [NC] RewriteRule ^(.*)$ /my/sub...

Htaccess Rewrite Rule But Not When File Extension Present

I am trying to create a RewriteRule for paths but not for files. This code works for paths but if a file is requested such as an image or CSS file this is also pointed to the index.php file which is incorrect behavior! RewriteRule (.*)/(.*) index.php?$1/$2 Any ideas how to fix this!? Thanks Matt! ...

mod_rewrite beginner: map files to php files

I'm trying to write a simple rule such that: /page gets implicitly routed to /page.php. Inversely, I'd like any direct access to /page.php to be redirected in the address bar to /page. Currently I have: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php But that d...

How to redirect any /promotion/* URLs to just /* with .htaccess?

I need to redirect any requests to mysite.com/promotion/* pages to just mysite.com/*, so a few examples would be: mysite.com/promotion/some/page.html would redirect to mysite.com/some/page.html mysite.com/promotion/another-page.html would redirect to mysite.com/another-page.html How can this be done with .htaccess? ...

(Recursive) Regular expression for .htaccess file

I'm trying to modify my web page, which I currently use QueryStrings to display pages, and want to change website URLs to "search engine friendly" ones. I'm a newbie in regular expressions and also in .htaccess file, and I want to change URLs from http://someaddress.bla/index.php?lang=en&amp;rootCategory=$rootCaty&amp;leafCategory=$lea...

How would I use mod rewrite to send visitors to www?

This should be a very simple question to answer. How would I setup a .htaccess file to send visitors from mydomain.com to www.mydomain.com? I just had some Ajax headaches caused by the same-source rule, and this should be an easy way around it. ...