mod-rewrite

mod_rewrite in .htaccess

Hey all, how can I reduce this: www.example.com/index.php?page=viewblog&category=awesome down to this: www.example.com/blog/awesome The above lists all of the blog posts in that category, but I also want scope for adding the title of the post on the end of it as well, like this: www.example.com/index.php?page=viewblog&category=awe...

lighttpd rewrite to nginx

hi, please help me to convert this lighttpd rewrite expression to nginx "^/static/(.*)" => "/static/$1", "^/super/(.*\.html)(?:\?(.*))?" => "/yatasha_super.cgi?$2", "^/(.*\.html)(?:\?(.*))?" => "/yatasha.cgi?$2" i try to do like this rewrite ^/static/(.*) /static/$1 rewrite ^/super/(.*\.html)(?:\?(.*))? /yatasha_super.cgi?$2 rewrite ...

redirecting with mod-rewrite

The below rule I took from here and modified it (very little) so it adds a slash after removing the php file extension. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)/$ $1.php So the url Domain.com/file.php will look like Domain.com/file/ And it works fine as long as I ...

How can I remove the .php extension using .htaccess rules?

I need for my .htaccess file to take away the .php file extension and replace it with just a trailing slash. Also, I have a profile.php page which will normally be visited with a numeric querystring parameter, like "profile.php?id=3". So on top of replacing extensions with slashes, how do I make "profile.php?id=3" look like "profile/3/...

mod_rewrite: remove trailing slash (only one!)

Hello. I use mod_rewrite/.htaccess for pretty URLs. I'm using this condition/rule to eliminate trailing slashes (or rather: rewrite to the non-trailing-slash-URL, by a 301 redirect; I'm doing this to avoid duplicate content and because I like URLs with no trailing slashes better): RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{RE...

Using mod_rewrite to hide .php from the end of URLs

I've got a site where all the pages are php scripts, so the URLs end .php. I've added the following to a .htaccess file, and I can now access the .php files without the .php extension: RewriteEngine On # Turn on rewriting RewriteCond %{REQUEST_FILENAME}.php -f # If the requested file with .php on the end exists RewriteRule ^(.*)$ $1...

Nginx re-writes combining $server_name and $request_uri?

How can I write an nginx rewrite that will redirect traffic sent to the root of a site but not sent to paths below root? In other words: I want to rewrite any request to http://foo.bar.com to redirect to http://foobar.com But any request for http://foo.bar.com/baz should go ahead and go there. The below redirects any request to foo.b...

Mac mod_rewrite interprets PHP filenames as directories?

I have the following set up working on my live hosting environment (Dreamhost, which I believe is Linux) and also on my Windows environment, but OSX is being tricky. I have the following files in my root directory: resume.php projectName.php What I would like is for projectName.php to map to /portfolio/projectName/. I have the followin...

Help on rule on .htaccess

I have made an .htaccess to my root directory for creating a subdomain level, assume it is sub.domain.ex that redirect to domain.ex/deb/ RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} sub.domain.ex RewriteCond %{REQUEST_URI} !deb/ RewriteRule ^(.*)$ /deb/$1 [L] and this works well. Now, I go to /deb/ and create another .htac...

Rewrite in htaccess on Wordpress

Hey All, I made the mistake of creating a site in a folder on a test domain and now I want to redirect any traffic to that URL to the new one. For instance I have: http://subdomain.example.com/blog and I want it to go to a complete new domain. Any help is appreciated. Thanks, Matt ...

nice url with apache and php

I have urls like /story.php?id=31 I want to show it as /31.html How? ...

Wildcard subdomains using htaccess

Hi all, I'm having some trouble getting the code statement beneath to work as intended. The first part of the code is all good. When a user hits example.com without 'www', he's being 301 redirected to www.example.com to protect the ingoing links. At the same time I'm trying to use subdomains. If a user hits candybar.example.com I want ...

"Drupal is not defined" Javascript error and drupal.js gives "Page not found" error

I'm installing Drupal like I've always done and I start to see this error in the console. I know Drupal object is defined in drupal.js, so I open up the source file and click on /misc/drupal.js and it says "page not found." Huh. That's weird because I can see that file is in my system, just where it should be. But somehow Drupal cannot f...

htaccess querystring to multiple paths

I've got a site with the following .htaccess rule: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?id=$1 </IfModule> It works great but I need to expand it so that IF there is another path taken by the user, I can forward it (but the root p...

url in subfolder?

Please help me. How can I do for www.example.com/search.php?q=skipsoft to www.example.com/skipsoft? ...

Regex for String Parameter!

I am trying to implement a Url Rewriting and struggling to figure out pattern matching for SC%3aArgument1+Argument2+%26+Argument3+Argument4. Any help is great!! ...

How to internally rewrite / to /homepage with mod_rewrite

Ok, this should be simple, but I'm having a fair amount of trouble with it. Basically, I'm trying to rewrite http://server.com/ to http://server.com/homepage, but I only want it to rewrite it internally--the user should never see the /homepage URL. I tried this: RewriteRule ^$ /homepage [L] And it properly matches the URL, but it iss...

.htaccess rewrite rule preventing infinite loop

I have a directory named dollars that contains a file index.php. I would like for the url http://localhost/dollars/foo to translate to dollars/index.php?dollars=foo. This is the .htaccess file that I currently have in the dollars directorty: Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !^index\.php RewriteRu...

URL Rewriting in Joomla

HI i want to rewrite my home menu http://example.com/main/ to http://example.com/main/index.php only . How can i do this using .htaccess Thanks ...

redirect to http

I have some rewrite rules in my .htaccess that switches the domain to https if its a secure area. I want it to switch back to http if its not a secure area, heres my rules: RewriteCond %{SERVER_PORT} =443 RewriteCond %{REQUEST_URI} !^/account(.*)$ RewriteCond %{REQUEST_URI} !^/shop/checkout(.*)$ RewriteRule ^(.*)$ http://www.domain.com/...