Search Results

Search found 2277 results on 92 pages for 'mod rpaf'.

Page 64/92 | < Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >

  • Simulating a 2-level If-Else using RewriteCond

    - by hlissner
    Hi! I'm trying to get my head around RewriteCond, and want to rewrite any requests either to a static html page (if it exists), or to a specific index.php (so long as the requested file doesn't exist). To illustrate the logic: if HTTP_HOST is '(www\.)?mydomain.com' if file exists: "/default/static/{REQUEST_URI}.html", then rewrite .* to /default/static/{REQUEST_URI}.html else if file exists: {REQUEST_FILENAME}, then do not rewrite else rewrite .* to /default/index.php I don't seem to have much trouble doing it when I don't need to test for the HTTP_HOST. Ultimately, this one .htaccess file will be handling requests for several domains. I know I could get around this with vhosts, but I'd like to figure out how to do it this way. Here's where I am at now: RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com$ [NC] RewriteCond /default/static/%{REQUEST_URI}.html -f RewriteRule . /default/static/%{REQUEST_URI}.html [L,NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . /default/index.php [L,QSA] I'm not too familiar with some of the other flags, will any of them be of use here (like chain|C, next|N or skip|S)? Thanks in advance! UPDATE: I've managed to do it, but would appreciate alternatives: RewriteEngine On RewriteRule ^(.+)/$ /$1 [L] RewriteCond %{HTTP_HOST} ^(domainA|domainB)\.com [NC] RewriteCond %{DOCUMENT_ROOT}/%1/static/%{REQUEST_URI}.html -f RewriteRule (.*)? /%1/static/$1.html [NC,L] RewriteCond %{HTTP_HOST} ^(domainA|domainB)\.com [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule .* /%1/index.php [L,QSA]

    Read the article

  • Htaccess help, $1 being used before its set??? what?

    - by jiexi
    I have this snippet RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php|images|img|css|js|robots\.txt) RewriteRule (.*) index.php?/$1 [L] It won't allow me to access a file at website.com/js/main.php but it will let me access index.php According to my webhost, $1 is being called before it is set. Any solutions? I'll accept answers when i get back tomorrow. Thank you!

    Read the article

  • How to successfully Rewrite a URL with .htaccess

    - by Ian Storm Taylor
    Hello. I am trying to rewrite mysite.com/broadcasts to mysite.com/feed so that it will show up in the location bar as "broadcasts" but actually go to /feed. Here is what I have in the .htaccess file: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^broadcasts(/)?$ /feed/ </IfModule> But this isn't working... I get a 404 error. Wondering if I'm doing something stupidly wrong. Thanks!

    Read the article

  • .htaccess trickery multi-language website

    - by user1658741
    I have a website right now that uses two languages (french and english) The way it works right now is that if someone goes to mysite.com/folder/file.php for example, file.php is simply a script that figures out which language to use, get's it's own path and filename(file.php) and serves up mysite.com/en/folder/file.php (if the language is english). However what shows up in the URL is still mysite.com/folder/file.php. For any folder and any file the same script is used. If I want to add a new file I have to add the file to the folder the user types into the browser as well to the en and fr folders. Could I do some .htaccess trickery so that whatever URL is typed, one .php file gets open that checks the language and what folder/file was requested and then serves up the correct language file? here's the php file that is served up for any files in the URL. <?php // Get current document path which is mirrored in the language folders $docpath = $_SERVER['PHP_SELF']; // Get current document name (Used when switching languages so that the same current page is shown when language is changed) $docname = GetDocName(); //call up lang.php which handles display of appropriate language webpage. //lang.php uses $docpath and $docname to give out the proper $langfile. //$docpath/$docname is mirrored in the /lang/en and /lang/fr folders $langfile = GetDocRoot()."/lang/lang.php"; include("$langfile"); //Call up the proper language file to display function GetDocRoot() { $temp = getenv("SCRIPT_NAME"); $localpath=realpath(basename(getenv("SCRIPT_NAME"))); $localpath=str_replace("\\","/",$localpath); $docroot=substr($localpath,0, strpos($localpath,$temp)); return $docroot; } function GetDocName() { $currentFile = $_SERVER["SCRIPT_NAME"]; $parts = Explode('/', $currentFile); $dn = $parts[count($parts) - 1]; return $dn; } ?>

    Read the article

  • getting error 500 with .htaccess when pointing an existing file / folder (mod_rewrite)

    - by Leto
    i made a simple .htaccess file to expose the problem. I want that all request made to the folder redirect to a subfolder file "app/index.php" RewriteEngine On RewriteRule (.*) app/index.php [QSA] And this works fine on with the basic url of my hoster (like http//myname.hosting.com/htaccessFolder The problem is that i have a domain pointing on this folder, and when accessed to it, server return Internal Server Error 500. If i do this : RewriteEngine On RewriteRule (.*) somefile.php [QSA] Redirection works only when file does not exists (404 not found error occured). when the file exists i get a 500 error too. I've asked the hosting support without success for the moment..

    Read the article

  • rewrite rule to skip folder [closed]

    - by redcoder
    RewriteEngine on RewriteBase /tradesalvage/demo RewriteRule ^featured-cars/?$ index.php [L] RewriteRule ^current-stock/?$ carlist.php [L] RewriteRule ^about-us/?$ aboutus.php [L] ErrorDocument 500 /tradesalvage/demo/500.php ErrorDocument 404 /tradesalvage/demo/404.php I have the above rule in .htaccess when access url "http://localhost/tradesalvage/demo/about-us" , it does redirect to aboutus.php file .It also works fine with the rest of the rule. But i have a problem when i create a admin folder.WHen access "http://localhost/tradesalvage/demo/admin/add-data" , it goes to the 404 error page.How do I write the rule to skip the admin folder ?

    Read the article

  • 301 Redirect. Need help. Having a hard time.

    - by Soma
    I'm trying to use mod_rewrite to redirect URLs and can't get anything to work. Here is what I'm hoping to do: Old URL: http://www.example.com/asp.pl?%5Fpuri=astore.amazon.com%2Fthegi02-20%2Fdetail%2FB0001L0DFA%2Fassid Needs to redirect to: www.example.com Anyone know of any way to do that?

    Read the article

  • Using .htaccess to rewrite dynamic subdomains

    - by brokekidweb
    I'm currently using .htaccess to rewrite on my website to create dynamic subdomains. I also use it to remove the .php extension on all pages. However, once inside the subdomain, it tries to redirect again. For example, if you went to https://admin.example.com/test, it would actually be accessing https://example.com/clients/admin/test.php. I keeping getting various 404 errors using the following .htaccess file: Options +MultiViews Options +FollowSymLinks RewriteEngine On RewriteRule ^subdomains/(.*)/(.*) http://$1.example.com/$2 [r=301,nc] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$ [NC] RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.example\.com$ [NC] RewriteCond %{DOCUMENT_ROOT}/%2%{REQUEST_URI}/ -d RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L] RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$ [NC] RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.example\.com$ [NC] RewriteRule ^(.*)$ clients/%2/$1 [QSA,L] How can I keep this from redirecting to https://admin.example.com/clients/admin/test.php?

    Read the article

  • Converting IIS Redirect to .htaccess

    - by user1641321
    I am having trouble getting the rewrite to work on an apache server. The end result is so i can make subdomains on the fly just by adding a directory. For example anysubdomain.domain.com will redirect to domain.com/anysubdomain and still appear as anysubdomain.domain.com. Is there anyone out there that convert this for me? <rewrite> <rules> <rule name="Subdomain Redirect" patternSyntax="ECMAScript" stopProcessing="true"> <match url="^(.*)$" /> <conditions trackAllCaptures="true"> <add input="{HTTP_HOST}" pattern="^www\.obdevsite\.com" negate="true" /> <add input="{HTTP_HOST}" pattern="^(.*)\.obdevsite\.com" /> <add input="{REQUEST_URI}" pattern="^(.*)$" /> </conditions> <action type="Rewrite" url="/{C:1}/{C:2}" appendQueryString="false" /> </rule> </rules> </rewrite>

    Read the article

  • Subdomain to folder htaccess

    - by mikelbring
    I am trying to point sub.domain.com to domain.com/app/*sub, but the farthest I can get is making it a redirection and I do not want it to redirect. Here is what I have, it works but it redirects it instead of staying on the subdomain, which is what I want. RewriteCond %{HTTP_HOST} ^(.*).example.com RewriteCond %{HTTP_HOST} !^www.example.com [NC] RewriteRule ^(.*)$ http://example.com/app/%1/$1 [L]

    Read the article

  • Redirecting only if user asks for the root of the domain nad are froma particular country

    - by lphmedia
    Hi, I need a rule and condition to handle this scenario: User from US visits www.domain.com, domain.com, www.domain.com/ or domain.com/ this should be redirected to www.domain.com/usvisitor/ However, if a user from the US visits www.domain.com/anydirectory it will let them straight through without a redirection occurring. eg. RewriteEngine On RewriteBase / GeoIPEnable On GeoIPDBFile /var/share/GeoIP/GeoIP.dat RewriteEngine on RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^US$ RewriteCond %{HTTP_HOST} ^domain.com$ [L] RewriteRule ^/$ http://www.domain.com/usvisitor$1 [L] I know the RewriteConditons and rules are wrong - just can't get my head around it!

    Read the article

  • need .htaccess RewriteRule advise

    - by Abuda Dumiaty
    I've looked around for an answer to this, no luck. what i want to do is replace: http://localhost/mysite/admin/something with: http://localhost/mysite/admin/?p=something Here's the best formula I came up with since yesterday: RewriteEngine On RewriteBase /mysite/ RewriteRule ^(superv/)([^\?/]+)$ $1\?p=$2 [NC] Yet it's not working. Note: It think the "RewriteBase" thingy has nothing to do with the problem because this line is working like a charm: RewriteRule ^(javascripts/main\.js)$ $1\.php [NC] Any ideas? thanks in advance.

    Read the article

  • Changing /page.php to /page/

    - by Dirge2000
    Hey there, I'm trying to change all http://www.mysite.com/filename.php files to show as http://www.mysite.com/filename/ using mod_rewrite, but I seem to be doing something wrong. Can anyone help out? I'm guessing it's something pretty simple for those that know. Thanks.

    Read the article

  • .htaccess for multiple application in Kohana V3

    - by khairil
    Hi I have setup multiple application in Kohana v3, it works normally without enabling .htaccess (to remove index.php or admin.php) my setup + system/ + modules/ + applications/ + public/ + bootstrap.php + ... + admin/ + bootstrap.php + ... + index.php (for 'public' application) + admin.php (for 'admin' application) so to access the frontend sample url will be; http://mydomain.com/index.php/(controller_name)/... and to access administration site; http://mydomain.com/admin.php/(controller_name)/... The task is, I want to remove and replace index.php (default url) and admin.php with /admin/ using .htaccess (mod_rewrite) so it can be http://mydomain.com/(controller_name) <- 'public' application http://mydomain.com/admin/(controller_name) <- 'admin' application my current .htaccess (not working) is; # Turn on URL rewriting RewriteEngine On # Installation directory RewriteBase /ko3/ # Protect hidden files from being viewed Order Deny,Allow Deny From All # Protect application and system files from being viewed RewriteRule ^(?:web-apps|modules|core)\b.* index.php/$0 [L] # Allow any files or directories that exist to be displayed directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # TODO: rewrite admin URL to admin.php/URL #RewriteRule ^admin/(.*) admin.php/$0 [L] # Rewrite all other URLs to index.php/URL RewriteRule .* index.php/$0 [PT]

    Read the article

  • Remove in between folder structure from the url in a php website

    - by pabz
    I have a php website having following folder structure (basic structure). project_name app controller model view css js img index.php So when I view index.php in WAMP the url is http://localhost/project_name/ But when I go inside the site (eg. login.php which resides under view folder) url is like this. http://localhost/project_name/app/view/login.php I found that using .htaccess we can change the urls. So I tried this (in .htaccess). RewriteEngine on RewriteBase / Redirect 301 /project_name/app/view/login.php /project_name/login.php RewriteRule ^/project_name/login.php$ /project_name/app/view/login.php [L] Now url is http://localhost/project_name/login.php It is correct. But it seems php does not use the original link to grab the file (ie. from /project_name/app/view/login.php) but from here /project_name/login.php So it throws 404 error. What should I change? Please help me, i am just trying to hide /app/view/ part from the url so that user won't see my folder structure. I have read about various ways of doing that for about 9hrs today but still couldn't get anything working correctly. Hope my question is clear enough. Any help is greatly appreciated!

    Read the article

  • SE friendly URLs appache code snippets

    - by Dan
    I want example.com/23-45 be transformed to example.com?id=23-45 Could you please post the code I should add to .htaccess file to make this work (Is this everything I should do to make this work - add a piece of code to .htaccess file ???) Thanks a lot!

    Read the article

  • & symbol problem in htaccess

    - by muralikalpana
    hello.... my current url is categories_name.php?cname=at&t rewritten url like this. carriers/at&t this is htaccess url. RewriteRule ^carriers/(.*)$ categories_name.php?cname=$1 [L] above url is working for all like categories_name.php?cname=all-tel when variable(at&t) has '&' symbol then problem occuring. so how to write htaccess url?

    Read the article

  • Apache mod_rewrite replace characters in REQUEST_URI

    - by frio80
    I'm trying to write some .htaccess rules that replace certain characters in the REQUEST_URI parameter. Specifically, I want to replace the following: "<" = &lt; "" = &gt; "'" = &apos; '"' = &#x22; ")" = &#x29; "(" = &#x28; Example URL could be http://www.example.com/?<script>alert(1)</script>&q=")("<script') I've tried a whole bunch of methods with no success. Can someone point me in the right direction? Thanks.

    Read the article

  • Url rewriting : prevent to display xml

    - by Frank
    Edit : I've got an aspx file (default.aspx) that loads a flash file (index.swf), but this swf needs a xml file (foo.xml) to load correctly. However, I would like to block any request aiming directly at the xml file. Is it possible, using a rewritting engine (isapi_rewrite for example) to detect if the xml file is being 'hotlinked' or being loaded by the 'index.swf'(inside default.aspx)? Any ideas? Thank you.

    Read the article

  • How do I rewrite a request by hostname unless it is a specified value?

    - by Tim
    My app will have a regular domain - let's say example.com - which will have information about logging in, signing up, etc. It will also host numerous other domains dynamically. My app serves the webpage for these at http://example.com/site/foobar.com/ So, I need to redirect all requests where the hostname is not example.com to /site/[hostname]/ I'm writing this in Django and hosting with Apache. How do I set up a rewrite rule to do this? The user must not know they are on any other site but foobar.com and if the user browses to foobar.com/something - the URL must be rewritten to /site/foobar.com/something

    Read the article

  • mod_rewrite failing on uppercase dir

    - by user1855277
    I have a very basic mod_rewrite in a .htaccess file which I'm sure worked last time I looked at it, but now it is doing strange things with the case of the REQUEST_URI. It's intended purpose is to rewrite sub-domains to a given file, passing the subdomain as a php var of bnurl. Here is my code: RewriteCond %{REQUEST_URI}= "RSDEV/location/" [NC] RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.co\.uk(:80)? [NC] RewriteRule ^RSDEV/location/$ RSDEV/newmain.php?bnurl=%1&accesstype=new [NC,L] Now, typing joebloggs.mydomain.co.uk/RSDEV/location/ into my web browser comes back with the response "The requested URL /RSDEV/location/ was not found on this server" which is a correct statement because /RSDEV/location/ is not a real directory, but why did it not rewrite to RSDEV/newmain.php?bnurl=joebloggs&accesstype=new as expected? Now, the really strange thing here is that if I enter joebloggs.mydomain.co.uk/rsdev/location/ into my browser (note rsdev is now lowercase), it correctly rewrites as expected. The script newmain.php is in dir RSDEV (uppercase) so if it was going to fail, I would have expected it to fail the other way round with the lowercase rsdev. As you can see, I have [NC] on each line. Is this my mod_rewrite code failing or some other mystical server force keeping me up all night?

    Read the article

  • How to only allow users to a page through a rewrite?

    - by Pietu1998
    I have a website where I am using SSI to include some stuff to the front page. However, I'd like to show users an URL that ends with .html. I have accomplished that via a .htaccess and mod_rewrite redirect. RewriteRule ^index\.html$ index.shtml [PT,L] Also, I am using another redirect pointing to this URL to internally load the pages' content with JavaScript (example.html to index.html#example.html) with a condition for not redirecting index.html. Now, I'd like to make the .shtml page 403 Forbidden. This is also easy: RewriteRule ^index\.shtml - [F] But, now index.html also gets forbidden. I have tried adding L to the .html-to-.shtml rule, but this doesn't help. How could this problem be solved?

    Read the article

  • .htaccess redirect noticably increasing load time

    - by GTCrais
    I set up a SEF link via .htaccess RewriteRule to one of the articles on my website just to see how that works, and it does work but it considerably increases the load time of that particular page. On average the articles (including the one I'm talking about, when not using the rewrite rule) load in about 1.3 seconds. With the rewrite rule, the load time is 3.3 seconds on average until the page displays, and the loader thingy in the firefox tab keeps spinning for another 2 seconds. I have WAMP setup on my computer, and the website is being accessed through no-ip.com. Here is the .htaccess config (very simple, as you can see): Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^o-sw-liji /NewSWL/o-nama.php?body=o-sw-liji In httpd.conf I have this (somewhere I read this might affect the load time for some reason - searching for files through all the directories or something, I don't remember exactly what I read): <Directory /> Options None AllowOverride None Order deny,allow Deny from all </Directory> DocumentRoot "Z:/Program Files (x86)/wamp/www/" <Directory "Z:/Program Files (x86)/wamp/www/"> Options None AllowOverride All Order allow,deny Allow from all </Directory> Any ideas why .htaccess redirect increases the load time by so much? UPDATE: so I put a session based counter in the "o-nama.php" script. Apparently when I access the web via the 'normal' link i.e. 'o-nama.php?body=o-sw-liji', the counter increases by one, as it should - it's one page load. But when the page is accessed through the redirected link, i.e. 'o-nama/o-sharewood-liji' the counter increases by 6-8, which naturally makes the load time a lot longer, since it's loading the same page for 6-8 times. I have no idea why this is happening. Any help is appreciated.

    Read the article

< Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >