Search Results

Search found 4313 results on 173 pages for 'mod rewrite'.

Page 12/173 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • .htaccess rules to rewrite URLs to front end page?

    - by Dizzley
    I am adding a new application to my site at example.com/app. I want views at that URL to always open myapp.php. E.g. example.com/app -> example.com/app/myapp.php and example.com/app/ -> example.com/app/myapp.php What's the correct form of rewrite rules in the .htaccess file? I've got: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /app/ RewriteRule ^myapp\.php$ - [L] RewriteRule ^myapp.php$ - [L] RewriteRule . - [L] </IfModule> ...based on what the Wordpress front-end does. But all I see at example.com/app is a directory of files. :( (I put those rewrites at the top of my .htaccess file). Any ideas? Update What actually worked: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/app(/.*)?$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . /app/myapp.php [L] This is good because: Explicit or implicit calls to app/myapp.php work. example.com/app redirects to app/myapp.php example.com/app/ redirects to app/myapp.php example.com/app/subfunction redirects to app/myapp.php All other calls to example.com/otherstuff are untouched. Item 4 is Wordpress-like Front Controller pattern behaviour. I think that rule RewriteCond %{REQUEST_URI} ^/app.*$ [NC] needs refining as it allows /app-oh-my-goodness etc. through too. Thanks for the answers.

    Read the article

  • Rewrite img and link paths with htaccess and serve the file from rewritten path?

    - by frequent
    I have a static mockup page, which I want to "customize" by switching a variable used in image-src and link-href attributes. Paths will look like this: <img src="/some/where/VARIABLE/img/1.jpg" alt="" /> <link rel="some" href="/some/where/VARIABLE/stuff/foo.bar" /> I'm setting a cookie with the VARIABLE value on the preceding page and now want to modfiy the paths accordingly by replacing VARIABLE with the cookie value. I'm a htaccess newbie. This is what I have (doesn't work): <IfModule mod_rewrite.c> # get cookie value cookie RewriteCond %{HTTP_COOKIE} client=([^;]*) # rewrite/redirect to correct file RewriteRule ^/VARIABLE/(.+)$ /%1/$1 [L] </IfModule> So I thought my first line gets the cookie value and stores this in %1. And on the second line I'm filtering VARIABLE, replace it with the cookie value and whatever comes after VARIABLE in $1. Thanks for sheeding some light on what I'm doing, doing wrong and if I can do this at all using htaccess. EDIT: I'm sort of halfway through, but it's still not working... Mabye someone can apply the finishing touches: <IfModule mod_rewrite.c> # check for client cookie RewriteCond %{HTTP_COOKIE} (?:^|;\s*)client=([^;]*) # check if an image was requested RewriteCond %{REQUEST_FILENAME} \.(jpe?g|gif|bmp|png)$ # exclude these folders RewriteCond %{REQUEST_URI} !some/members/logos # grab everything before the variable folder and everything afterwards # replace this with first bracket/cookie_value/second bracket RewriteRule (^.+)/VARIABLE/(.+)$ $1/%1/$2 [L] </IfModule> Still can't get it to work, but I think this is the correct way of doing it. Thanks for help!

    Read the article

  • Apache rewrite rules redux

    - by AlexanderJohannesen
    I've got a REST framework that when plopped into any directory should Just Work(TM), and it seems to work fine when I've got projects in subdirectories, but not if it's in root. So, given a few example directories; / /project1 /bingo/project2 /hoopla/doopla/minor/project3 All of these works fine, except I'm getting "funnies"* when the project runs in the root directory (bit hard to explain, I suppose, but the second level rewrites are not working properly). Here's my attempt at a generic .htaccess file: RewriteEngine On RewriteRule ^static/ - [L] RewriteCond %{REQUEST_URI} ^$ RewriteRule .* ./ [R,L] RewriteRule ^index.php - [L] RewriteRule (.*) index.php?q=$1 [QSA,PT] (And yes, all projects have a subdirectory ./static which is ignored by rewrites) What I'm trying to achieve is a set of rewrite rules that work for most cases (which is, again, plonking the project in a directory the webserver serves). I'm not a rewrite rules wiz by a long shot, and any good advice and gotchas would be appreciated (and yes, I've gone through too many introductory articles. I need some serious juice.) More info on the funnies; my webserver has docroot in one spot (under /usr/share/apache2/default-site/), but a set of rules that says that /projects is pulled in from somewhere else that's not a subdirectory of docroot (/home/user/Projects/). When I go there, I get a list of /projects subdirectories, and if one of those subdirectories gets called (restmapp) with the proposed rewrite rules, I get ; The requested URL /home/user/Projects/restmapp/index.php was not found on this server.

    Read the article

  • Nested URLs and Rewrite rules in Apache2

    - by Radha Krishna. S.
    Hi, I need some help with rewrite rules and nested URLs. I am using TikiWiki for my website and am in the process of setting up SE friendly URLs for my projects. Specifically, I have the following rewrite rule for www.example.com/projects to point to a page that lists out all the projects hosted in example. RewriteRule ^Projects$ articles?type=Project [L] This works fine. Now, I would like to point www.example.com/projects/project1 to point to a specific project. I have this rewrite rule RewriteRule ^(Projects/Project1)$ tiki-read_article.php?articleId=6 This works, but partially. The content is all rendered as text but the theme - images/ css etc all go for a toss - the page is completely in text. I understand that this happens 'cause the relative paths in the theme/ css/ images all refer to Projects as the base folder instead of the root of the website. I don't want to touch the CMS portion - change the theme/ css/ image paths in the files, more for reasons of upgradability. Can someone help me understand and write a rule so that the above nested URL works? Regards, Radha

    Read the article

  • Mod rewrite for fake subdomains?

    - by Axel
    Hello, I really tried tons of methods but i'm not successful. I want a .Htaccess code to do the following : I want to rename this : http://www.mydomain.com/media -- http://media.mydomain.com So, By example instead of calling this : http://www.mydomain.com/media/XXX/picture.jpg i will call : http://media.mydomain.com/XXX/picture.jpg Thanks

    Read the article

  • Exclude a directory from a rewriterule using ISAPI rewrite 3

    - by mludd
    Basically I've recently added the below rule in my httpd.conf for ISAPI rewrite on an IIS server to make sure that it always defaults to lower-case file and directory names. RewriteRule ^(.*[A-Z].*)$ $1 [CL,R=301,L] This is all fine and dandy for every part of the site except for one directory which we can call /MisbehavingDir, the code in this particular directory is filled with mixed-case filenames and lots of server- and client-side scripting that would have to be rewritten to use all lower-case in order to work properly (with the RewriteRule above it seems to hit a couple of 301s in the wrong places which causes that part of the site to function poorly to say the least). Since I'm not in the mood for rewriting that part of the site I'd love to find a good way to modify the above regex so that it matches everything except paths starting with MisbehavingDir and since my regex-fu isn't really good enough I figured I'd ask here. Is there a simple "beautiful" solution to this that anyone wants to share or should I just set aside several days to rewrite the app, then test it and go through that whole dance?

    Read the article

  • IIS7 URL Rewrite with dynamic subdomains.

    - by arri.me
    My goal is to implement the following scheme using the subdomain and path as attributes: Use a wildcard DNS entry that routes any subdomain to the root site: Example: *.example.com ex: http://xyz.example.com to http://example.com Next I want to rewrite the requests to point to a specific page, passing both the subdomain and the request path as attributes. Example: http://xyz123.example.com/images/header.jpg to http://example.com/get.aspx?id=xyz123&path=/images/header.jpg I've seen several questions on here regarding similar goals, but not quite the same. I'm new to using rewrite rules, so any help is appreciated. I will update this as I make progress.

    Read the article

  • apache mod-rewrite issue

    - by mike
    I've modified my .htaccess file to have the following statement RewriteCond $1 !^index.php$ RewriteRule ^/?([^/]+)$ index.php?c=home&m=details&seo=$1 [L,NS] This allows me to use product URL's like this: http://domain.com/product_name However, when trying to access a file at the same level as index.php, it always calls the RewriteRule above and errors out. I need to be able to access files like below, but each URL currently attempts to load index.php. http://domain.com/about.htm http://domain.com/terms.htm http://domain.com/robots.txt etc Any suggestions on how I can modify my htaccess file to get this to work correctly?

    Read the article

  • Chained address rewrite

    - by kemp
    What I need to do is rewriting this address: (1) http://localhost/wordpress/fake/text-value to (2) http://localhost/wordpress/gallery?somevar=text-value Notes: the remapping must be transparent: the user always has to see address (1) gallery is a permalink to a wordpress page, not a real address I basically need to rewrite the address first (to modify it) and then feed it back to mod rewrite again (to let wordpress parse it its own way). Problems if I simply do RewriteRule ^fake$ http://localhost/wordpress/gallery [L] it works but the address in the browser changes, which is no good, if I do RewriteRule ^fake$ /wordpress/gallery [L] I get a 404. I tried different flags instead of [L] but to no avail. How can I get this to work?

    Read the article

  • Wordpress rewrite image path

    - by Brad
    I've got a website that is running WordPress. It has several pictures that I am retrieving from a datafeed. The images from the datafeed are at locations like: http://image4.example.com/640/examples/example.jpg http://image4.example.com/640/example.jpg The image4 and 640 locations can change. I want to rewrite the images to where they show as from my website. I've tried: rewritecond %{HTTP_HOST} !^image4.example.com$ rewriterule ^([^/]+)$ http://image4.mywebsite.com/$1 [L,R=301] but it doesn't work. I don't know much about Mod Rewrite. any help would be appreciated, and no I'm not hijacking the images, i have permission to use them and the bandwidth. Thanks -Brad

    Read the article

  • Mod Rewrite Trouble

    - by Adrian
    I want to have a main section which is found on services.php and then some sub-sections like services_logodesign.php. I want to make url's look like: When I click a button to open services_logodesign.php the browser should show "services/logo design" I have several other sub-sections, it will be nice to have one code for any other pages.

    Read the article

  • Needs some help with an apache mod-rewrite issue

    - by mike
    I've modified my .htaccess file to have the following statement RewriteCond $1 !^index.php$ RewriteRule ^/?([^/]+)$ index.php?c=home&m=details&seo=$1 [L,NS] This allows me to use product URL's like this: http://domain.com/product_name However, when trying to access a file at the same level as index.php, it always calls the RewriteRule above and errors out. I need to be able to access files like below, but each URL currently attempts to load index.php. http://domain.com/about.htm http://domain.com/terms.htm http://domain.com/robots.txt etc Any suggestions on how I can modify my htaccess file to get this to work correctly?

    Read the article

  • htaccess mod rewrite NOT

    - by Neddy
    Hi, I have a small problem with url rewriting on apache. I would like it that it ignores the admin/ folder from rewriting. Options +FollowSymLinks RewriteRule ^([^/]*)/([^/]*)\.html$ /index.php?cat=$1&name=$2 [L] RewriteRule ^([^/]*)/$ /index.php?cat=$1 [L] I have triend doing it myself but I can't figure it out. Thanks.

    Read the article

  • Chained address rewrite in Wordpress

    - by kemp
    What I need to do is rewriting this address: (1) http://localhost/wordpress/fake/text-value to (2) http://localhost/wordpress/gallery?somevar=text-value Notes: the remapping must be transparent: the user always has to see address (1) gallery is a permalink to a wordpress page, not a real address I basically need to rewrite the address first (to modify it) and then feed it back to mod rewrite again (to let wordpress parse it its own way). Problems if I simply do RewriteRule ^fake$ http://localhost/wordpress/gallery [L] it works but the address in the browser changes, which is no good, if I do RewriteRule ^fake$ /wordpress/gallery [L] I get a 404. I tried different flags instead of [L] but to no avail. How can I get this to work?

    Read the article

  • Cannot force https on certain pages using mod rewrite

    - by Demian
    force https RewriteCond %{HTTPS} =off [NC] RewriteCond %{REQUEST_URI} ^/?(bingo/account|bank)(.*)$ RewriteRule ^.*$ https://%{HTTP_HOST}/%1 [R=301,L] RewriteCond %{HTTPS} =on [NC] RewriteCond %{REQUEST_URI} !^/?(bingo/account|bank).*$ RewriteRule ^.*$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] it's a nightmare, when i go to /bank i get a redirect loop error or weird redirects, in fact, not the expected behavior, what should i do?

    Read the article

  • Redirect in combination with a rewrite condition in htaccess

    - by Robbert van den Bogerd
    Hi all! I've got a cms-driven website, with no option to change the code. What I want to accomplish is creating friendly url's, using only apaches mod-rewrite engine. The problem is I'm creating an infinite loop, because I first redirect the original url (index.php?id=21) to a friendly one (/friendly/) and then rewrite the '/friendly' part back to 'id=21' I know there should be an extra condition or parameter to avoid looping in this case, but I can´t get one of the possible solutions to work. Here´s the code: RewriteCond %{query_string} ^id=21$ [NC] RewriteRule /* /peuterspeelzaal? [R=301,L] RewriteRule ^peuterspeelzaal$ index.php?id=21 [L]

    Read the article

  • .htaccess mod force extra characters

    - by user1090809
    I need to be able to write/post links on the web that look like 'mysite.com/?d=foo', and take the user to filepath '/foo.php'. Here is my htaccess: RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^([^/]+)/$ $1.php [L] RewriteRule ^([^/]+(/[^/]+)*)/$ /$1.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$ RewriteRule ^([^.]+[^/.])$ /$1/ [R=301,L,NC] Baically I need to "force" '/?d=' before the filename, kinda like I've already modded my htaccess to force a trailing slash. How do I need to reconstruct my htaccess to make that possible?

    Read the article

  • Mod rewrite with multiple query strings

    - by Boris
    Hi, I'm a complete n00b when it comes to regular expressions. I need these redirects: (1) www.mysite.com/products.php?id=001&product=Product-Name&source=Source-Name should become -> www.mysite.com/Source-Name/001-Product-Name (2) www.mysite.com/stores.php?id=002&name=Store-Name should become -> www.mysite.com/002-Store-Name Any help much appreciated :)

    Read the article

  • Mod Rewrite Rule not matching certain words

    - by Andy Gee
    I'm no expert in mod_rewrite at all and I'm trying to add a condition to the rule below to: match which is not equal to 'share' not match anything with a dot in it RewriteRule ^([^/]*)$ http://domain.com/directory/index.php?key=$1 [L] http://domain.com/directory/share will not be matched (share) http://domain.com/directory/foo.php will not be matched (contains a dot) http://domain.com/directory/abcde will be matched http://domain.com/directory/abcde-4 will be matched All ULRs will not have a trailing slash Any help will be much appreciated

    Read the article

  • Rewrite Mod issue

    - by Caro Fiedler
    I have the follow code: if (isset($_GET['preis']) && $_GET['preis']==="0-100-euro"){ $preis = "WHERE preis >= 0 and preis <= 100"; } elseif (isset($_GET['preis']) && $_GET['preis']==="100-200-euro"){ $preis = "WHERE preis >= 100 and preis <= 200"; } elseif (isset($_GET['preis']) && $_GET['preis']==="200-300-euro"){ $preis = "WHERE preis >= 200 and preis <= 300"; } elseif (isset($_GET['preis']) && $_GET['preis']==="300-500-euro"){ $preis = "WHERE preis >= 300 and preis <= 500"; } else { } $abfrage = "SELECT * FROM outfits $preis LIMIT $start, $eintraege_pro_seite"; $ergebnis = mysql_query($abfrage); example.com/?preis=100-200-euro works but example.com/preis-100-200-euro/ is not This is my htaccess: RewriteEngine On RewriteRule ^preis-([^-]*)/seite-([^-]*)/$ ?preis=$1&seite=$2 [L] RewriteRule ^preis-([^-]*)/$ ?preis=$1 [L] RewriteRule ^seite-([^-]*)/$ ?seite=$1 [L] I use the same rules for many other links and it works fine, but only in this case not

    Read the article

  • htaccess password protection and mod-rewrite?

    - by mathiregister
    hey guys, i wonder how i can solve the following problem. on the root directory of my server lies a file calles upload.php i want to be able to add a "/upload" (without .php) to my URL and the browser should ask for a password (and maybe username if possible). I i enter the password (and username) correctly upload.php should be opened. Is this possible with htaccess?

    Read the article

  • Mod Rewrite - Simple Question

    - by bob
    This is my current .htaccess Options +FollowSymLinks DirectoryIndex index.php RewriteEngine On RewriteBase /product/ RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteRule ^(.+)\.php$ ./$1/ [R=301,L] RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L] RewriteRule ^contact/?$ ./contact.php [QSA,L] Everything is working fine now.. /product/contact return to /product/contact/ /product/contact.php return to /product/contact/ Question.. How to make all my .php will be /contact/ /help/ /faq/ Now I should to add contact.php help.php faq.php to the htaccess I tried to add RewriteRule ^(.*)/$ $1.php [QSA,L] but it will be return loop. Let me know how to fix it ;)

    Read the article

  • mod rewrite and automatic redirection

    - by Klemen
    Hello! I have this rule written in my .htaccess RewriteRule ^blog/([0-9]+)/? /obdelaj.php?ime=$1 which works but it redirects me to example.com/obdelaj.php?ime=# and i want the user to stay on example.com/blog/# I have a hostgator account and i dont have access to the httpd file , and i presume that a some configuration in httpd file is causing this, because on my localhost machine this work just fine. So what would i have to add to the .htaccess to overwrite this automatic redirection? Thank you

    Read the article

  • Problem with mod rewrite for multi-lingual site

    - by Chris
    Hi everyone Currently developing a multi-lingual website, Users can access the front page using url with format below: http://mydomain.com/en/ http://mydomain.com/fr/ Problem is here. URL without last "/" (http://mydomain.com/fr) caused page not found problem Here is the rule RewriteRule ^/?([^./]+)/(.*)$ $2?lang=$1 [L,QSA] Can anybody help ? Thanks in advance

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >