mod-rewrite

Apache ReWrite rule stopping portions of our app

Hey Guys, Our application uses rewrite rules in our PHP application and our developer added these rewrite rule to our Apache VHosts file: I have updated our Rewrite rules based on suggestion below. Currently my VHosts file configuration looks like this: RewriteCond %blog !-d RewriteRule ^/([a-zA-Z0-9-,]+)/?$ /index.php?a=$1 Rewrit...

mod-rewrite problem in codeigniter

Hello, I'm developing a site on my localhost (Usbwebserver application). I'm using CodeIgniter framework: url is "http://localhost/daniel/index.php" with the following options: config/routs: $route['default_controller'] = "site"; config/config: $config['base_url'] = "http://localhost/daniel"; $config['index_page'] = ""; $config['...

Htaccess, mod_rewrite and regular expression for alphanumeric and dashes only

Hi, Just can't figure aout those regular expressions. I have an .htaccess file with some url rewrites. Look below what I have now: RewriteRule ^news news/ [R] RewriteRule ^news/([-A-z0-9]+)/$ news/$1 [R] RewriteRule ^news/([-A-z0-9]+)$ index.php?news=$1 [L] I don't think this is correct, I mean I think it could be better. This is w...

How to prevent rewriting href attributes when rewriting urls?

Hello, on my web site i want to change url's from (just exemple): site.com/showCategory.php?catId=34 to: site.com/category/34/ Here is the contents of my .htaccess file: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^affichage/([0-9]+)$ /affichage/$1/ [R] RewriteRule ^affichage/([0-9]+)/$ /affichage.php?n=$1 </...

How to encode URL in Apache mod_rewrite?

I'm now doing it this way: rewriterule ^questions/tagged/(.*) qas.php?q=[$1] Which didn't do encoding stuff yet. ...

mod_rewrite or path_info for clean URLs

Hi, I have always used mod_rewrite for creating clean looking URLs, until recently I didn’t know there was any other option. A few weeks back someone on here pointed out that exactly the same effect can be achieved using apache PATH_INFO. Thinking about it now, I assume this is what most PHP frameworks do, optionally relying on mod_rewr...

mod rewrite causing error with pretty urls in SMF forum

I installed a mod (pretty urls) to rewrite the urls of this SMF forum and it works for all the boards except this one: http://mmaturf.com/forum/genghis-con's-turf/ I believe it has to do with apostrophe, but my mod rewrite skills are negligible. The rule that was created looks like this: # Rules for: boards RewriteRule ^([-_!~*'()$a-...

Apache mod_rewrite issue with WAMP - shows Error 404 Not found - Joomla 1.5.14 with SEF URL

Hi, I am newbie to Joomla and WAMP environiment. I am using WAMP environment: Win Srv 2003 R2 (Std Ed) with SP2 and all recent updates Apache 2.2.9 PHP 5.2.6 Joomla 1.5.14 I want to enable mod_rewrite with Joomla SEF URL but it is not working together. If I set 'SEF URLs' and 'Add suffix to URLs' as Yes it works. Result: /index.p...

creating a default varible in mod_rewrite

I have mod_rewrite take this url: mydomain.com/directory/index.php?slug=slug&year=2009 and make it pretty: mydomain.com/directory/slug/2009/ Easy, but now my issue is, if someone lands at the URL without the year attached (like: mydomain.com/directory/slug/), how can I add the current year to the URL? My current htaccess reads: R...

Redirect specific file request (at any location) to specific location

I have a specific file, let's call it 'myfile.abc', that I need to have redirected to a specific location, no matter what location it's requested from. For instance: /folder1/myfile.abc /folder2/myfile.abc /folder3/myfile.abc I need all the above to be redirected to (as an example): /myfolder/myfile.abc How do I achieve that within...

mod_rewrite help

Using mod rewrite for the first time. Please help me with these rules I'd like my urls rewritten for pages as follows: list.php?city=dallas >>> list/city/dallas profile.php?id=12 >>> profile/zaknuman (username retrieved from db) story.php?id=33 >>> story/there-are-no-ants-in-texas (story title retrieved from db) ...

How can I rewrite URLs?

I want to convert this URL: mysite.com/cgi-bin/test.cgi/some_random_numbers_and_letters/http/www.somewebsite.com into: mysite.com/www.somewebsite.com I also want to convert this URL: mysite.com/addname.php into: mysite.com/add/ How do I do that? ...

htaccess rewriteRule restrict access to one particular folder problem

Hello, I have problem with getting the folder inc restricted. It is only the inc folder in the root directory and not the inc folders higher up de hiarchie Problems are: IE will start a download/open dialog and FF displays an include file I don´t have this problem with the images folder wich is also in the root directory. What...

Complex htaccess rewrite rules - where do i start ?

Hi I have asked on here before about mod_rewrite and got the perfect answer but now I need to do something more complex and really needed the advice of someone who knows mod_rewrite much better. My rewrite rule looks like this so far: RewriteRule ([a-zA-Z_-]+)/([0-9]?) index.php?cat=$1&page=$2 And that shows the URL as follows: /cat...

Apache Mod_Rewrite Question

I have a certificate that is registered to the fully qualified domain name of a server on our intranet (webserver.domain.com). When our internal users hit this site via the fully qualified name, they go right in and aren't prompted that it's an invalid cert. If they browse to the web server via the hostname (non-fully qualified) they ...

REALLY basic mod_rewrite question...

I am trying to use SEO-friendly URLs for a website. The website displays information in hierarchical manner. For instance, if my website was about cars I would want the URL 'http://example.com/ford' to show all Ford models stored in my 'cars' table. Then the URL 'http://example.com/ford/explorer' would show all the Ford Explorer Model...

Using mod_rewrite only if a 404 would have occured

I am in the process of converting a static website into one using a cms. I have the cms installed in a sub directory of the public directory. To avoid ending up with ugly domain names (http://example.com/cms/) is there an easy way using mod_rewrite to rewrite http://example.com/… to http://example.com/cms/… while ensuring that if the req...

How to use RewriteRule in Apache to redirect from /abc/ to /abc?

RewriteRule ^([^/\.]+)/$ $1 [R] redirects from website.com/abc/ to website.com/home/user/www/abc How do I redirect to the correct location? (website.com/abc) ...

mod_rewrite rewrite all but index.php

In my htaccess i have RewriteRule ^([^/]+)/?$ cms.php?seotitle=$1 [L] The idea is that index.html will load fine and then anything requested at domain.com/anythinghere.html will use the rule of grabbing the file from cms.php. However its not working - any clues? Really need this sorted asap. ...

mod_rewrite needed

lets says I have a domain example.com and I have wildcards dns switched on. on example.com a user can signup with username and password. once registration is done, username.example.com starts redirecting to example.com/script/script.php?user=username. address bar would still show username.example.com what would be the contents of the .h...