mod-rewrite

mod_speling internal redirect, or how to handle caps with mod_rewrite

I have this rule: RewriteRule ^(panel|admin|site)/([A-Za-z0-9]+?)/(scripts|assets)/(.*)$ Project/$2/Public/$3/$1/$4 [L] The idea is to allow access to public assets as they exist inside modules of code. The only issue is that the naming scheme requires title case (lets assume this is unchangeable). Hence, a request to: /site/users/sc...

Error 403 when accessing an address to rewrite

I have the following rewrite rules: RewriteRule ^products/([a-zA-Z]+)$ /proyect/clients/index.php?database=$1&module=products [L,QSA] The directory structure is as follows: /var/www/proyect/clients/index.php When writing the address "http://host/products/clientA/" is directed into the "/proyect/clients/index.php?database=clientA&mo...

URL rewrite in .htaccess file

Hi all, I have two problems in my current .htaccess. The script below works but has a limitation RewriteRule ^products/([0-9])$ /products/$1/ [R] RewriteRule ^products/([0-9])/$ /viewad.php?adid=$1 Limitation: if adid, is more than 10. it fails. I want it to have whatever number still there and work. my current solution was to add...

Pretty URL - mod_rewrite question

I'm trying to setup a simple mod_rewrite for formatting "pretty URLs". All I need is for something like: http://www.example.com/dir1/dir2/logs?page=12 to tranlate to http://www.example.com/logs/12 How would my .htaccess rule look like? ...

ISAPI Rewrite of HTTPS Domains

I'm pretty new to isapi rewrites on IIS. I need to get the following rule applied :- I need https://www.xxx.co.nz to be redirected to https://www.xxx.com - including any additional paths and/or query strings. I've tried this but it just loops: #RewriteCond %HTTPS on #RewriteCond Host: (?!^https://www.xxx.co.nz)(.+) #RewriteRule /(.*)...

htaccess not working on ssl on

.htaccess rewrite rule is not working on https RewriteRule ^/templates/Styles/screen.css$ /css/scaffold/index.php?f=screen.css i.e. for http://example.com rewrite it's working fine but https://example.com rewrite it's not working I am using ubuntu and apache2 ...

Rewriting an arbitrary number of path segments to query parameters

Hi all, I have this .htaccess rule: RewriteRule viewshoplatest/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/$ /viewshoplatest.php?$1=$2&$3=$4&$5=$6&$7=$8&$9=$10&$11=$12&$13=$14&$15=$16 It should map a URL like this: http://www.veepiz.com/viewshoplatest/start/10/end/10/filter/0/ownerid/0/sortby/date...

How to rewrite urls like this ?

How would I rewrite ( for every posts in my blog ): http://localhost/post.php?id=13 to http://localhost/this-is-the-title-of-the-post/13 AND ( without id ) http://localhost/post.php?id=13 to http://localhost/this-is-the-title-of-the-post/ ...

htacess mod_rewrite

Hi, I have a page on my site called map-xml.php which is an RSS feed of housing properties. To enable me to submit this to Google's Data Feeds it needs to have an .xml file extension. So how would I go about writing a rewrite rule in htaccess which would make map-xml.xml work? Thanks! ...

ModRewrite with HTTPS

I'm using the following mod rewrites to ensure not only canonical URLs but also that the site is displayed using HTTPS: RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} // It think the problem must be here --^ RewriteCond %{HTTP_HOST} ^rto12\.ca$ [NC] RewriteRule ^(.*)$ https://www.rto12.ca/$1 [R=301,L] Rew...

How to rewrite /foo-bar to foo-bar.html but /foo/bar to foo-bar.html using mod_rewrite?

How to rewrite /foo-bar to foo-bar.html but /foo/bar to foo--bar.html using mod_rewrite? In other words, replace all slashes in the request URI with --, then append .html. I wrote the following code: RewriteEngine On RewriteBase / # Take care of /foo/bar and /foo-foo/bar-bar RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_F...

Problem with PHP sessions in WordPress with non-default permalinks

Hi, I'm experiencing a weird problem that occurs when I change the default permalinks in WordPress. When I place this code in my functions.php file in my theme (or even in the root index.php file in WordPress) and navigate between and updating a few pages (for example the /about page), my counter often runs twice. This problem is repr...

Help with dynamic RewriteRule in .htaccess

Hi, I would like to use RewriteRules in .htaccess to achieve particular url rewriting, but can't get it right, can somoene help? I'm trying to rewrite the path (everything between the first and last /) into one query string, and the filename into another e.g: http://domain.com/users/admins/testuser.html rewrites to http://domain.com/...

Removing a folder name from a url using mod rewrite

I have a url structure that looks like this: http://www.blahblah.com/community/i/pagename However, I want to remove the ugly /i/ part. Is this possible with Modrewrite? ...

What is the .htaccess/mod_rewrite solution for this redirect problem?

(Please see important Additional information edited in near the bottom of question) I'm trying to get the following url http://www.example.co.uk/home/templates/cnb/fb_calendar/events/view/289 to redirect to http://www.example.co.uk/home/index.php?option=com_content&task=view&id=574&Itemid=85&direct=view:289 I t...

How to resolve url from query into route

I'm trying to find a way get the symfony 1.4 to render the page: /detail/id/1 when url called is: /?url=/detail/id/1 Any ideas? Been googling around but so far haven't found the solution for it. Any ideas? I know it could be done with rewrites but i hoped i can do it through routing.yml somehow. ...

Apache rewrite example.com/forum to be example.com/index.php?page=forum

Im a complete beginner with Apache re-writes. Im trying to get example.com/forum to be example.com/index.php?page=forum Here is my rewrite file <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^/forum$ index.php?page=forum RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index...

Multilanguage site, redirect based on cookie or accept-language (RewriteRule)

Hi, A few weeks ago i asked a question about a multilanguage site (see http://stackoverflow.com/questions/3439668). That works perfect (thanks for that) But since I want to make my website nicer and I started adding more languages a new problem showed up. I want to see if I can redirect users directly to the site in their language, if ...

Simple RewriteRule question

Hi all, This seems so simple, but I can't figure it out... I would like all requests to be rewritten to index.php (which will interpret the request) apart from 404.html which should be rewritten directly to 404.php. The following code does work at rewriting everything to index.php, but 404.php never gets triggered. I have left line 3 ...

How can I convert this Apache Rewrite rule into a Tuckey UrlRewriteFilter Rule?

I have the following Apache Rewrite rule <IfModule rewrite_module> RewriteEngine on RewriteMap tolowercase int:tolower RewriteCond $2 [A-Z] RewriteRule ^(.*)/(.*).html$ $1/${tolowercase:$2}.html [R=301,L] </IfModule> that changes this: http://localhost.localdomain.com/FooBarBaz.html to this: http://localhost....