.htaccess

Apache mod rewrite .htaccess problem

My site is a php based site, but I've added wordpress in a /blog/ folder. The .htaccess file below should allow the /blog/ folder to be accessed, but I get a 404 error saying that blog.php doesn't exist. <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !\.(gif|jpg|png)$ RewriteCond %{REQUEST_FILENA...

can i set a 301 redirect into a rewrite rule?

Can i set a 301 redirect into a rewrite rule? eg can i set a 301 redirect into this code? RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2&isolang=$1$4 [L,E] ...

Basic 301 Redirection Help

I am trying to learn redirection for a WordPress site of my own. I am testing the concept of redirecting a single WordPress post by using a dummy site. However, it doesn't seem to be working for me. I am trying to redirect www.perfectmatchmaker[dot]org/finding-the-right-matchmaker to www.perfectmatchmaker[dot]org/finding-the-perfect...

Problem switching back from forced SSL on certain pages using mod_rewrite

Client wants login pages to load via https. This is easily accomplished, but since the site uses pretty url's, we now stay in https mode when clicking around after login is finished. This breaks secure files which are uploaded in the CMS, stored above webroot, and downloaded by streaming through a php script if user has the appropriate...

Redirect with htaccess for images onto another server without redirect looping

Hey guys, I currently have a host where my main site is hosted on. I have set up nginx on another server to mirror/cache files being requested if it doesn't have it already, in particular images and flv videos. For example: www.domain.com is my main site. www.domain.com/video/video.flv www.domain.com/images/1.png I would like to as...

Drupal htaccess redirect - all files in directory to new directory

Hiya, I've moved a site to Drupal, but am now getting a lot of 404 errors due to the search engines taking their time to update the indexes. The 404 paths all look similar to this: recipedata/ccp1300006/633_L.jpg recipedata/ccp1500005/risotto.jpg recipedata/ccp1500006/haddock.jpg So I'd like to do some htaccess redirection with mo...

htaccess turn on php flags if certain IP address

In my .htaccess file I need to turn on the following: php_flag display_errors On php_value error_reporting 2147483647 However I only want to do this if my IP is visiting the site. Any ideas? Something like... if (ip == "x.x.x.x") { php_flag display_errors On php_value error_reporting 2147483647 } Need to do this in .htaccess ...

Friendly URLs with .htacces NOT working... and stackoverflow URLs style...

I know this question has been asked a million of times here at stackoverflow, but I cant get it to work so I need someone who knows to finally resolve this problem! I want that when this is inserted in the URL: http://website.com/pelicula/0221889/ http://website.com/pelicula/0221889/posters/ It really goes to this: http://website.co...

URL rewrite using .htaccess

I need a url like mydomain.com/myname/?action=post&data=10 here in a single php page(user.php) i need all 'myname','post' and '10' as get method variables. How can i get it using .htaccess???... plz help me..... ...

this code redirects to the dynamic url how can i change it so that it directs to the new static url?

This code changes the dynamic url to static but it redirects to the dynamic url. How can i set this so that it redirects to the dynamic url? RewriteRule ^lang-([a-z]{2})/([0-9]+)-([a-zA-Z0-9-]).html(.)$ /product.php?id_product=$2&isolang=$1$4 [L,E,R=301] ...

Make Apache to show different index.html also in browser's address bar

I have the following foloder tree on my shared hosting server: www.somesite.com | |_ public_html (document folder) |_ .htaccess (Apache file) |_ index.html (page shown by server now when someone looks for www.somesite.com) | |_ site_editor (folder) | |_login.html (site editor control panel) | |_file1.php ...

Using .htaccess to replace backslash in URL with forward-slash

I realise that a backslash should never appear in a URL in a form other than a URL escape code, however in this case the URL's are being generated by a .NET application for generating flashbooks. I have contacted the developer of this application with a bug report. In the interim i would like to use .htaccess to rewrite the offending b...

Changing /page.php to /page/

Hey there, I'm trying to change all http://www.mysite.com/filename.php files to show as http://www.mysite.com/filename/ using mod_rewrite, but I seem to be doing something wrong. Can anyone help out? I'm guessing it's something pretty simple for those that know. Thanks. ...

mod_rewrite - strange [R] behavior

Hello! I'm doing something very simple with mod_rewrite and it's behaving strange. It's behaving as if I'm using the [R] option, but I'm not. Here's a simple test for a .htaccess file: RewriteEngine on RewriteRule ^page1$ page2 This should redirect a request for page1 to page2, but leave the URL in the web browser still pointing to p...

HTACCESS: *.subdomain.domain.tld redir to subdomain.domain.tld/*

Hi guys, sorry for the vague question title. But anyways, I have here a subdomain which i wish to pass on wildcard sub-subdomains and make a proper htaccess redirect to a sub-folder (relative to the server root) equivalent to the wildcard value such that *.subdomain.domain.tld will redirect to subdomain.domain.tld/* where * = wildca...

.htaccess: Forward ALL requests to another site

Hello. I have to forward an existing website to another one. I want to forward each and every request on the old site to the root of the new site. Example: http://oldsite.tld/index.php?mode=foo&amp;action=bar should be forwarded to http://newsite.tld/ and not http://newsite.tld/index.php?mode=foo&amp;action=bar. Is this possible with...

.htaccess rewrite not working

I need help with a rewrite in .htaccess. I am trying to do the following: When a user types http://www.example.com/csc/alabama/ I need to pull info from http://www.example.com/csc/index.php?state=alabama I thought it should be this Options +FollowSymLinks RewriteEngine On RewriteRule ^csc/([^/]*)$ /csc/index.php?state=$1 [L] I keep ...

crontab and htaccess

Is it possible to execute from crontab a php file inside a folder which is protected with htaccess and how? ...

How to set the referer on a rewrite rule?

I have the following problem: I use a script that saves the referer URL. I want this URL to one of my own URLs. So let's say a users access the page http://example.com/page1 I want to rewrite that URL to http://example.com/page2 and safe the referer on that page. I don't want to do that with a PHP script as otherwise I would have to ext...

htaccess rewrite rule loads assets twice?

I am using these rules: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !\..+$ RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*+)$ /$1/ [L,R] RewriteRule !\.(js|ico|gif|jpg|png|css|html|swf|flv|xml)$ index.php But when I check resources loaded in chrome, I can see that my .css files are loaded twice. ...