Search Results

Search found 10299 results on 412 pages for 'apache'.

Page 198/412 | < Previous Page | 194 195 196 197 198 199 200 201 202 203 204 205  | Next Page >

  • .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

  • htaccess rewrite; Should I change all relative links or not?

    - by Camran
    I have a rewrite in htaccess which makes this: domain.com/ad.php?ad_id=bmw_m3_328942948 into this: domain.com/ads/bmw_m3_328942948 Problem is the links which are relative to the file wont work... for instance if a link is pointing at '/bin/edit.php' like this originally: domain.com/bin/edit.php // WORKS but after the rewrite the link wants to point here instead: domain.com/ads/bin/edit.php // NOT WORK - NOTE THE /ads/ DOESN'T EXIST IN REALITY Do you understand my issue? What is done about this? Do I have to make ALL links using the newer rewritten format? .htaccess: Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteCond %{REQUEST_URI} !^/ad\.php RewriteRule ^annons/(.*)$ ad.php?ad_id=$1 [NC,L] Thanks

    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

  • htaccess: Custom redirect from any folder to home.

    - by xRobot
    I have site with these files and foldes: /index.php ( that include php files contained in folder1 and folder2 ) /config.php /folder1/ /folder2/ I want this: when a user point to any folder ( folder1, folder2 or any other folder ) then he is redirected to index.php How could I 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

  • Creating a PHP web page that enables you to reboot the server in Linux?

    - by Stuart
    I want to create a web page that allows the user to initiate a reboot on the linux server. Obviously this would only be avaliable for system admins and would also be controlled by using iptables. Below is a sample of code that I was thinking of using but I wanted to know if there is another way to do this and how also to use this in a web page? Also is there any thing else that I should consider? $command = "cat $pass | su -c 'shutdown -r now'"; $output = array(); try{ echo shell_exec($command); exec($command, $output); system($command, $output); } catch(Exception $e) { print "Unable to shutdown system...\n"; } foreach ($output as $line) { print "$line<br>"; } Thanks in advance.

    Read the article

  • ZF Site in ZF Site? How do I redirect form subdirectory to another subdirecotry?

    - by AD
    The deal is that I have a ZF site for which root directory is /public. How should I go about redirecting to a subdirectory if I want to do next? I want to have another subdirectory under /public/ that would not be linked to a main website in any way except it using save ZF. Lets say I have this: /public/newsite/ which will include a complete modular ZF (just I have it for the main site). That is the root directory for the NEWSITE would be /public/newsite/public. So my question how do I modify my .htaccess rules so it would redirect any requests from /public/newsite/ to /public/newsite/public/? Thank you in advance.

    Read the article

  • Prevent .htaccess syntax error

    - by seengee
    Hi, As part of one our system's we enable a user in the backoffice to add a block of 301 redirects should they need to. This is just a textarea which then populates a specific area of a .htaccess file. As much as this may seem insecure it has only previously used internally by people who know what they are doing but for various reasons they cannot access the specific file. We need now to allow more access to this function, not for the general public, but for people that probably have far less knowledge of regexp etc and syntax in htaccess files. Obviously the major concern here is the user enters some bad syntax and makes their entire site, including the backoffice where they could fix the issue, totally inaccessible without manual intervention. What approaches can i take to make sure that they do not break their site? A htaccess syntax check? copy the file elsewhere and check it doesnt generate a 500 error (with cURL or similar)?. Would welcome any ideas. Thanks.

    Read the article

  • RewriteCond simply doesn't work, doesn't check properly if file exists

    - by ultranol
    Hey everybody. I've been trying to solve this for hours now but came up with nothing. Inside .htaccess, whenever somebody requests an image from a folder of my website, I'm trying to check if a file with the same name exists in another folder; if it does, return that file; if it doesn't, return the file originally requested. It seems so easy but it simply doesn't work. The .htaccess code is as follows: RewriteEngine On RewriteCond /images/blog/watermark/$1 -f RewriteRule ^(.*) /images/blog/watermark/$1 The "RewriteCond" always returns negative, so the image requested is always loaded as is. If I change it to, like, RewriteCond %{REQUEST_FILENAME} -f it always returns positive, so it gets the image from the folder I want - except when the image's not there, generating an error, which is exactly what I'm trying to prevent. What am I doing wrong? Thanks.

    Read the article

  • How to send java.util.logging to log4j?

    - by matt b
    I have an existing application which does all of its logging against log4j. We use a number of other libraries that either also use log4j, or log against Commons Logging, which ends up using log4j under the covers in our environment. One of our dependencies even logs against slf4j, which also works fine since it eventually delegates to log4j as well. Now, I'd like to add ehcache to this application for some caching needs. Previous versions of ehcache used commons-logging, which would have worked perfectly in this scenario, but as of version 1.6-beta1 they have removed the dependency on commons-logging and replaced it with java.util.logging instead. Not really being familiar with the built-in JDK logging available with java.util.logging, is there an easy way to have any log messages sent to JUL logged against log4j, so I can use my existing configuration and set up for any logging coming from ehcache? Looking at the javadocs for JUL, it looks like I could set up a bunch of environment variables to change which LogManager implementation is used, and perhaps use that to wrap log4j Loggers in the JUL Logger class. Is this the correct approach? Kind of ironic that a library's use of built-in JDK logging would cause such a headache when (most of) the rest of the world is using 3rd party libraries instead.

    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

  • .htaccess: RewriteCond syntax?

    - by Rosarch
    I'm using Drupal 6. Typically, when the user requests a URL for which Drupal has no response, it uses index.php as the error document. However, I'd like to suspend this behavior for a specific URL. How can I do this? RewriteCond %{REQUEST_FILENAME} !=fail RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] Where "fail" is the path I want to block. So www.example.com/fail should result in a 404. Incidentally, what does [L, QSA] do? I've looked at documentation without luck.

    Read the article

  • How do I do cron job for list of URLS

    - by mathew
    HI I do have a list of urls and my site is giving information about indexing and back links of any website out their. so what I want is I do have thousands of website lists with me and I want all that to run and store it in my database. so how do I do it using crone job?? the url address is for example www.mydomain.com/search?url=www.google.com so after google.com another one and all which is in the list.

    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

  • Redirect Subdomain

    - by user2237615
    I am trying to redirect an old website that was on Godaddy's website builder and Quick Blogcast to a new site on Wordpress. I have no problems redirecting from the old page structure to the new one. For example: For example: http://sapientservicesllc.com/About_Us.html redirected to http://sapientservicesllc.com/about-us/ I used: 301 redirect /About_Us.html http://sapientservicesllc.com/about-us/ In the htaccess file. My problem is that I need to redirect all of the blog posts that were on a subdomain to the new wordpress site. For example: http://blog.sapientservicesllc.com/2011/10/14/risk-mitigation.aspx redirects to http://sapientservicesllc.com/risk-mitigation/ http://blog.sapientservicesllc.com/2012/10/04/could-cold-air-channeling-help-your-data-center.aspx redirects to http://sapientservicesllc.com/cold-air-channeling-help-data-center/ This: http://blog.sapientservicesllc.com/atom.aspx redirects to http://sapientservicesllc.com/?feed=atom This: http://blog.sapientservicesllc.com/2012/11.aspx redirects to http://sapientservicesllc.com/2012/11/ How can I set up the redirect to go to the new site? I have set the subdomain to forward to the actual domain in the Godaddy settings (blog.sapientservicesllc.com forwards to sapientservicesllc.com.

    Read the article

  • Can I suppress or enforce URLs to be prefaced with http:// in ALL browsers?

    - by Ryan Dunlap
    I want to ensure that regardless of what browser a user is in, they all see the EXACT same characters in the URL bar. Most browsers show the preceding protocol type in the URL bar. However, Chrome for example truncates http:// (not sure about https) and starts with the domain name, ie: Chrome: stackoverflow.com/questions/ask Safari: http://stackoverflow.com/questions/ask So, is there a way to either suppress the http:// in all browsers, or even enforce it in all browsers? Preferably suppress.

    Read the article

  • MOD_REWRITE HELP!

    - by shahinkian
    I want to use mode rewrite to display the following: mydomain.com/Florida/Tampa/ instead of mydomain.com/place.php?state=Florida&city=Tampa I've akready done this: (since I think it might make a difference!) mydomain.com/[name].html instead of mydomain.com/profile?user=[name] Here is the code! Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteBase / RewriteCond %{SCRIPT_FILENAME}! !-f RewriteCond %{SCRIPT_FILENAME}! !-d RewriteRule (.*).html profile.php?user=$1 [QSA.L]

    Read the article

  • How to remove "index.php?" from HTACCESS [duplicate]

    - by Francis Goris
    This question already has an answer here: Reference: mod_rewrite, URL rewriting and “pretty links” explained 2 answers I have url like this: www.site.com/index.php?/genero/aventura/av/ But I would like this to be my new url: site.com/genero/aventura/av/ I used the following code: <IfModule mod_rewrite.c>RewriteEngine On RewriteCond %{HTTP_HOST} !^www.site.com/$ [NC] RewriteRule ^index.php\?/(.*)$ site.com/$1 [R=301,L] </IfModule> but only returns me: site.com/index.php?/genero/aventura/av/ This is my latest & full version: RewriteEngine on #RewriteCond $1 !^(index\.php|ver_capitulo\.html|google3436eb8eea8b8d6e\.html|BingSiteAuth\.xml |portadas|public|mp3|css|favicon\.ico|js|plantilla|i|swf|plugins|player\.swf|robots\.txt) RewriteCond $1 !^(index\.php|public|css|js|i|feed|portadas|robots\.txt|BingSiteAuth\.xml|plugins|i|mp3|favicon\.ico|pluginslist\.xml|google3436eb8eea8b8d6e\.html) RewriteRule ^(.*)$ /index.php?/$1 [L] #DirectoryIndex index.php #RewriteCond %{THE_REQUEST} http://www.page.com/index\.php [NC] #RewriteRule ^(.*?)index\.php$ http://page.com/$1 [L,R=301,NC,NE] #DirectoryIndex index.php #RewriteEngine On Thanks for reading.

    Read the article

  • How does this mod_rewrite code resolve properly?

    - by user532493
    My .htaccess file is as follows: Options -Multiviews RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ $1.php It works, but I'm wondering how it works. For example, if I type in example.com/main, I get the file at www.example.com/main.php. How do I get the .php extension if the code tells the rewriting to stop after adding the www. to the beginning of example.com?

    Read the article

  • mod_rewrite per-dir redirection returning a 400

    - by Eaterrust
    I moved my images directory to a different folder, and now I want to redirect all images requests from that folder to the new one. I do not have access to the main configuraion file, so I'm doing this in a .htaccess. I tried this, and it works:     RewriteCond %{REQUEST_URI} old_dir/.+.(jpg|png|gif)$     RewriteRule old_dir/(.+[^/]+..+)$ $1 [L,PT] But since they have permanently moved, I want to do a proper redirect, so I added the [R] flag, like this:      %{REQUEST_URI} old_dir/.+.(jpg|png|gif)$     RewriteRule old_dir/(.+[^/]+..+)$ $1 [L,PT,R] But the server gets confused, and returns a 400, so I looked at the log file, and this is what happens:     strip per-dir prefix: C:/wamp/www/natrazyle/old_dir/images/banner.jpg - old_dir/images/banner.jpg     applying pattern 'old_dir/(.+[^/]+..+)$' to uri 'old_dir/images/banner.jpg'     rewrite 'old_dir/images/banner.jpg' - 'images/banner.jpg'     add per-dir prefix: images/banner.jpg - C:/wamp/www/natrazyle/images/banner.jpg     explicitly forcing redirect with http://localhost/C:/wamp/www/natrazyle/images/banner.jpg As you can see, the full local path gets added after localhost I know I'm doing something wrong, I just can't figure it out myself. Any help would be greatly appreciated...

    Read the article

  • Using mod_negotiation to serve webp if the UA requests it.

    - by Rich Bradshaw
    Is it possible to use mod_negotiation to serve up a webp image if the browser supports it, and a jpg otherwise? For instance, if I link to an image with the path /images/test, it serves the image found at /images/test.webp if the UA knows about webp, or jpg otherwise? I've tried poking around, but it seems that the Accept headers in Chrome at least look like Accept:*/*, rather than specifying the image type. If this isn't the way to do it, has anyone got any other suggestions?

    Read the article

  • How can I limit user bandwidth usage?

    - by Scarface
    Ok, I have a site, and it serves all images and mp3s through a php script and can be controlled and limited, but I am now worried about overall bandwidth of my site. For example, what if someone just sends a million requests to one of my pages? Does anyone have any suggestions into server methods used to prevent this? Should I use mod_cband http://www.howtoforge.com/mod_cband_apache2_bandwidth_quota_throttling_p2?

    Read the article

  • why this httaccess code results into a redirect loop?

    - by user3606997
    Here I am stuck with my htaccess code. I have been trying to figure it out for the last 11 hours why am I getting a redirect loop for the below code. Options -Indexes +FollowSymLinks RewriteEngine on #Check for no www or www RewriteCond %{HTTP_HOST} ^dummysite.com$ [or] RewriteCond %{HTTP_HOST} ^www.dummysite.com$ [NC] RewriteRule . - [E=FIRSTPART:true] # IE 6 RewriteCond %{HTTP_USER_AGENT} !MSIE\s6 RewriteCond %{ENV:FIRSTPART} true RewriteRule ^(.*)$ https://www.dummysite.com/$1 [R=302,L] Why the above code results into a redirect loop? EDIT: What I actually want is that if the user is from IE6 then he should be redirected to http version with www as prefix no matter if he types www or not in the url. And on the other hand if the user is from any other browsers then he should be redirected to a https version with www as prefix no matter if he types www in the url or not.

    Read the article

< Previous Page | 194 195 196 197 198 199 200 201 202 203 204 205  | Next Page >