.htaccess

using apache's mod_rewrite to parse SEO friendly URL's

Hi - How do I convert something like me.com/profile/24443/quincy-jones to me.com/profile.php?id=24443 or something like me.com/store/24111/robert-adams to me.com/store.php?id=24111 with mod_rewrite? Can I make the reverse conversion as well with mod_rewrite, or would I have to parse it through PHP? ...

Do .htaccess php_value settings affect scripts run at command line?

I'm investigating the best place to set my error logging options, and it seems the most reliable place would be in .htaccess in the script subdirectory. But this particular script is run via cron, and therefore via command line. Do php_value settings made in .htaccess affect scripts that are not run through the web server? ...

How can I redirect to a different domain without changing the URL in the address bar?

I want to redirect from: domain1.com/photos To: domain2.com/photos I want the URL in the address bar to still read: domain1.com/photos. Is there a way to do this using only .htaccess? Note: My .htaccess file for domain1.com is currently completely blank. ...

.htaccess rewrite to redirect root URL to subdirectory

Trying to get www.example.com to go directly to www.example.com/store I have tried multiple bits of code and none work. Please help! What I've tried: Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com$ RewriteRule (.*) http://www.example.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^(.+)\www.example\.co...

url rewriting an id with a string variable

trying to figure out how to rewrite this url clientside blog.com/post/how-to-get-the-ladies to point serverside to blog.com/post.php?id=123 i know how to do this: blog.com/post/123 RewriteRule ^([^/]+)/?$ post.php?id=$1 [NC,L] but how do you replace the id string with the post title slug? ...

Why isn't this rewrite rule working?

I'm using the following code in my .htaccess: Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME}.php -f RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) $1\.php [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ /$1 [R=301,L] # Special rewrite rules # ideas/<id> RewriteRule ^ideas/([0-9]+)$ idea\?id=$1 # u...

How to pass-through requests not going to specific directories to index.php/path?

In my present project I've got several directories: application (my MVC files, which mustn't be accessed), images, css, and js. Effectively I want all requests to images/css/js to proceed unchanged, but all others I wish to call index.php/my/path. My .htaccess currently looks like this, and is wreaking havoc with my routing. <IfModule...

What's wrong with this htaccess redirect?

Hello folks, I recently turned an old Joomla site into a Wordpress site and I want to redirect the old urls to the correct new ones. For starters I tried to redirect them all to the homepage but even that didnt work. All the old urls look like website.com/?q=node/1 (or sometimes ?q=user/ etc), so I figured this would be enough: Rewrit...

.htaccess reverse rewrite without looping?

I have an existing page called bfly.php that I need to change to butterfly-jewelry.php I want to make it so that if someone goes to the URL butterfly-jewelry.php they get the bfly.php page but the url doesn't change it stays as butterfly-jewelry.php. BUT also if someone goes directly to bfly.php the url changes to butterfly-jewelry.php ...

Looking for "localhost" apache server that allows .htaccess

Hey all, Is there some apache server software out there that can be installed on my Windows PC (for local development purposes) that also allows .htaccess for URL rewriting? I'm currently using Xampp which does not seem to offer this functionality (although maybe I'm wrong about that). Any advice would be much appreciated. Thanks. ...

Include problems in PHP

I need to turn allow_url_include On. How can I do this? I have access to .htaccess as well as php.ini. I'm using PHP version 5.2.9 I've tried adding php_value allow_url_include On in .htaccess and allow_url_include = On in php.ini. Both files are at the root of my website. Is there a way to use the curl/get page function as a ...

Mod ReWrite Catch-All Subdomain

Basically I want *.domain.com to pull up domain.com/*/ (not redirect). I went into the subdomains section of cPanel and set a wildcard for this domain. It appears to be resolving correctly, ie *.domain.com is bringing up domain.com. I've now made a htaccess file in the public_html directory containing: Options +FollowSymLinks Options ...

Manual Sub-Domain Construction

I want to create subdomains manually on my website as in my current hosting plan I have no option of creating a subdomain. I think perhaps this is possible using .htacces??? Please give two examples in answers for agrimgupta DOT com/oranges --> blog DOT agrimgupta DOT com/ and agrimgupta DOT com/work/UniV --> study DOT agrimgupta DOT co...

How do I redirect domain to subdomain using htaccess?

Hi, .htaccess is a bit new to me! I have a current site located at www.domain.com and I'm building a new site at new.domain.com. When the new site is finished, I want to re-direct all traffic to the new subdomain. Also, I want to resolve url canonicalization at the same time. Any help appreciated! Thanks Mark ...

How can I make my .htaccess skip rules conditionally?

I want to redirect all URLs that do not contain "_js","_css", "_img", etc., to my dispatch script. Somehow it doesn't work. For instance, all files inside my /_js/ folder are unaccessible (meaning: they are sent to index.php instead of getting to the physical files residing in that folder). Here is my htaccess: IndexIgnore * Options +...

Run PHP code from .htaccess?

Say I have a rewrite that needs to pass the url to a PHP function and retrieve a value in order to tell what the new destination should be? is there a way to do that? Thanks. UPDATE: Thanks so far guys..I am still having trouble but i'll show you my code: .htaccess #I got the file path by echoing DOCUMENT_ROOT and added the rest. R...

Different page provided for Google Crawl

Hi, I have built a Twitter client that's only one page: index.html. When being used, it draws in content from JSON feeds to populate various columns. The issue is hardly any traffic is coming in from Google except for searches on the site's domain name. This is because Google only crawls index.html when it's blank and before the user ent...

htaccess: Why doesn't this work?

I get a 404 error page when I try the following rule in htaccess: RewriteRule ^Test\?service=(.*) test.php?foo=$1 [NC,L] How come? I know it's preferable to use something like ^Test/(.*) test.php?foo=$1 [NC,L] instead, but in this case I'd rather like it the way I stated. Thank you in advance. ...

Disable CakePHP folder override

I have a cakephp installation in the root of my domain. Now it turns out I need to put another app in there that will reside in a subdirectory. How do I disable the controller/model redirection in cake for just this directory? The current .htaccess in the root folder looks like this: <IfModule mod_rewrite.c> RewriteEngine on Rewr...

Is there a file-based equivalent to .htaccess in IIS6? (not config/plugin)

There are lots of similar questions to this, but they all seem to involve either configuring permissions or installing a plugin. I'm looking for a solution that is "dumb" - i.e. to allow the code to be deployed from source control and automatically have access to certain paths blocked, without anyone needing to configure the server. I ...