mod-rewrite

Help needed with mod_rewrite and htaccess for Drupal

I want to enable .htaccess files on my server in order to use "clean_url" functionality in Drupal. This is what I've done so far: sudo a2enmod rewrite sudo /etc/init.d/apache2 restart cd /etc/apache2/mods-enabled grep mod_rewrite * In phpinfo() results I can see: mod_rewrite, so I guess the module is enabled. I've added a htaccess f...

Mod_rewrite: How to catch .php files?

I'm trying to catch all .php requests so that my visitors won't be able to see the php magic I want example.com/home to be redirected to example.com/index.php, but I don't want direct access to example.com/index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] Although ...

Converting mod_rewrite Rules to IIS Rewrite Rules

I'm using http://github.com/lakshmivyas/hyde to generate my website, and it included .htaccess mod_rewrite rules, but I'm going to be self-hosting my website on a Windows server using IIS, so I was trying to import the existing .htaccess rules into the IIS Rewrite module, but the rules it imported weren't working correctly. Examples of ...

.htaccess mod_rewrite and navigating back directories

I have what may or may not be a peculiar problem, I need to point the htaccess file back three directories before finding the directory I am looking for. My understanding of navigating directories using mod_rewrite is limited, so I wanted to ask how to write an htaccess file that will do this: URL: example.com/css/styles.css Accesses fi...

http://mysite.com/foo/bar loading http://mysite.com/foo.php

I initially thought this was a problem with my .htaccess files, however even after disabling mod_rewrite the problem persisted. http://mysite.com/foo/bar is loading http://mysite.com/foo.php with this true for file foo being in any folder on the server. Does anyone know what is causing this behaviour and how I can stop this, as I want it...

httpd.conf rewriterules per project on local server

Hi, I am hosing multiple projects on the same local server and was wondering if it was possible to put the rewrite rules for each project in the httpd.conf file rather than in the .htaccess file for each project. Is the syntax exactly the same in the httpd.conf file to .htaccess because I've never used it before? Thanks. ...

htaccess calling rewrite rule on everything

This is my htaccess file: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Static pages RewriteRule ^print/([0-9]+)$ index.php?action=PublicDisplayPrint&page_id=$1 [L,QSA] RewriteRule ^email/([0-9]+)$ index.php?action=PublicDisplayEmail&page_id=$1 [L,QSA] RewriteRule ^login$ index.php?action=Pu...

mod_rewrite log with referers?

Is there any way to get mod_rewrite to log referers when it does a redirect? ...

.htaccess rewrite with drupal and clean urls only partially works?

Hey all, I am having an unusual access problem with Drupal running on a MAMP (Mac OSX, Apache, MySQL, Php) stack. The Drupal install is working fine, so I know it's not a Drupal issue. "Clean URLs" are working fine for anything with a single-level url, but nothing with 2+ path levels. For example: example.com/foo, example.com/bar, etc....

URL Rewriting .Net IIS7

Hi, My web app url is e.g. http://domainname/Search/SearchPage.aspx?SearchID=1-0-0-2-3. I have rewriten the url as follows The user may see the following url http://domainname/Search/SearchPage.aspx/1-0-0-2-3/DFDF/FDFDF My code is only conerned with the SearchID. Is there a way that i can ignore anything that comes after /1-0-0-2...

Ajax - mantaining state in the url - no #

I am working on an AJAX website where there are two search parameters. I did some mod-rewrite and checking for $_GET variables so that i can do something like.. site.com/var1/var2/ -> automatically do the search based on the parameters. Now what I want is for people who do the search manually, to be able to have the url in that format....

.htaccess url-rewriting help

I'm a bit confused on url writing in .htaccess and have a question about rewriting urls. My first question is I'm trying to do is have a one .htacces to make the urls go from http://www.website.com/index.php to http://www.website.com/Home/and another .htaccess to go from http://www.website.com/index.php to http://www.website.com/home.ht...

Link Duplicity problem with .htaccess and mod_rewrite

Sorry I couldn't come up with a better title. Here is my htaccess RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php [L,QSA] And this is my problem: localhost/validpage gives me the contents of localhost/validpage.ph...

Regex / mod-rewrite - picking up forward slashes

Hi Experts, I have the following regex in my .htaccess file RewriteRule ^suppliers/category/([\w\s-\/]*)$ /index.cfm?ct=suppliers.home/category/$1 [nc] For some reason this code is not picking up the forward slash properly. e.g. for the following url http://mydomainname.co.uk/suppliers/category/Archive/records%20Management I would e...

htaccess Rewriting a URL with a comma

I need to rewrite a url that contains a comma to another URL. The original URL also contains +'s (pluses) which I have figured out need to be escaped with a backslash, but the commas don't seem to be read properly. Here's what it looks it like: RewriteRule ^locations/New+York/Buffalo,\+Erie\+County,\+and\+Surrounding\+Areas$ "/locations...

301 Htaccess RewriteRule Query_String

Problem: Visitors open the url website.com/?i=133r534|213213|12312312 but this url isn't valid anymore and they need to be forwarded to website.com/#Videos:133r534|213213|12312312 What I've tried: During the last hours I tried many mod_rewrite (.htaccess) rules with using Query_String, all failed. The last message in this topic shows a ...

Htaccess RewriteRule trouble - How to redirect to a "re-written" url on the server?

I have the following rewrite rule which is working fine: RewriteRule ^([a-zA-Z\-]+)[/]?$ apply/?survey_folder=$1 which turns this: address.com/folder1/ into this: address.com/apply/?survey_folder=folder1 The problem is that I can't figure out a way to use a redirect to the rewritten URL. Using cfml as an example, (cflocation url="htt...

mod_rewrite and htaccess question

How should my .htaccess file look like if I want the following conditions to be met: if page requested is /webcam/* then actually show /show.php and if page requested is /tag/* then actually show /tag.php when searching on google for this, i only found how to meet one condition, but not two together. Thanks, ...

Get blog.domain.com to appear as www.domain.com/blog

I want to create a blog for an e-commerce website, but due to data security reasons I don't want to host the blog on the same machine as the website is hosted on. Is there a way to host it on a separate machine using the sub-domain of blog.domain.com but have it be accessible via the url www.domain.com/blog. My reasoning is that the c...

Strange behavior RewriteCond on Apache 2.2

working .htaccess config: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_URI} ^thumbs/(.*)$ RewriteRule ^(.+)$ /index.php [L,QSA] All 404 queries to /thumbs/ folder not must be catched by /index.php script. Why top .htaccess config work...