w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Apache trying to load from DocumentRoot instead of Alias directory
Maybe you are missing out the Directory directive for the aliased directory? This configuration works fine for me: [...] DocumentRoot /web [...] <Directory /web/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> Alias /web2/ "/var/www/" <Directory "/var/www"> Options FollowSymLinks AllowOverride None </Directory> [...]

Categories : Apache

mod_rewrite htaccess parent directory
Looks pretty close. Can you this code instead: Options +FollowSymLinks -MultiViews RewriteEngine on RewriteBase /users/prp/ RewriteCond %{HTTP_HOST} !^intranet [NC] RewriteRule ^(.*)$ http://intranet/$1 [L,R=302,NE]

Categories : Htaccess

Reusing returned user inputted value from class without re-requesting input from user
You're calling the method that asks the user for their username. Instead, create a private field in your StaffLogin2 class like this: private String username and set it with the returned value from the user like this: public void username() { this.username = JOptionPane.showInputDialog("Enter Username:"); } Then, reference this field elsewhere with by calling the following getter method, which should be in your StaffLogin2 class: public String getUsername() { return username; } One other thing - if you're intending this app to be used by more than one person at a time, you'll want to lose the "static" modifiers on your methods and instantiate a class. Probably a better practice for something like this anyway.

Categories : Java

How to access a file in a directory from other directory, when both are in same parent directory with HTML
if dir1 and dir2 are in the same parent directory then this is how you access 2.html from 1.html: <a href="../dir2/2.html">link to 2.html</a> hope it helped :)

Categories : HTML

Login to Facebook button without requesting user permission
I don't need any of the user's personal info So why to use the facebook API? You must be fetching at least the ID of the user right? That's the part of just the basic information; so in the least case the user will be prompted to grant the permission to your app to fetch the basic info. You shouldn't bother much, since most of the users don't hesitate sharing just their basic information.

Categories : Facebook

Python joining current directory and parent directory with os.path.join
You can use normpath, realpath or abspath: import os goal_dir = os.path.join(os.getcwd(), "../../my_dir") print goal_dir # prints C:/here/I/am/../../my_dir print os.path.normpath(goal_dir) # prints C:/here/my_dir print os.path.realpath(goal_dir) # prints C:/here/my_dir print os.path.abspath(goal_dir) # prints C:/here/my_dir

Categories : Python

Get parent directory's parent directory name in java
Have a look at http://developer.android.com/reference/java/io/File.html#getParentFile() Applying this twice will probably get you the right directory. But note that you program might or might not be allowed to go there, based on the settings in the file system and the context your code runs in.

Categories : Java

SSO using Apache Directory and Apache Camel
I don't think this question is related to Camel directly. If you want to build a SSO system, I think you can take a look at the oauth. Then you can pass the token as http uri parameter across the back end services.

Categories : Apache

Htaccess - map directory to url and hide directory name
Have your code like this: Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase /test2/ RewriteCond %{HTTP_HOST} ^www.example.com$ [NC] RewriteRule ^git(/.*|)$ git-service/bootstrap.php?request=GIT [L,NC] RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteCond %{HTTP_HOST} ^www.example.com$ [NC] RewriteRule ^git-service(/.*|)$ bootstrap.php [L,NC]

Categories : PHP

How to print the name of my current directory's parent directory
You can use ${PWD%/*}: $ echo $PWD /home/me/test/t $ echo ${PWD%/*} /home/me/test As the expression ${string%substring} Strips shortest match of $substring from back of $string (reference).

Categories : Shell

How to redirect all sub-directory pages to parent directory?
Add this to your .htaccess file RedirectMatch 301 ^/folder/$ http://example.com/folder What this basically does in corresponding to your question is redirect anything (be it sub directories, or files) inside the folder directory to your parent folder.

Categories : PHP

.htaccess apache 2.2 to 2.4 update
This is what I get in both Apache 2.2 and 2.4 With .htaccess file like this: RewriteEngine On RewriteCond %{REQUEST_URI} !^/views/.*$ #allows to access views folder and everything in it. RewriteCond %{REQUEST_URI} !^test.php$ #allows to access views folder and everything in it. RewriteCond %{REQUEST_URI} !^phonegapFunction.php$ #allows to access views folder and everything in it. RewriteRule ^([a-zA-Z0-9æøå]*)/?(w*)/?(.*)$ /app.php?team=$1&page=$2&value=$3 [L] This is the error I get in the error logs, for both versions: /var/www/localhost/htdocs/.htaccess: RewriteCond: bad flag delimiters But if I remove the comments: RewriteEngine On RewriteCond %{REQUEST_URI} !^/views/.*$ RewriteCond %{REQUEST_URI} !^test.php$ RewriteCond %{REQUEST_URI} !^phonegapFunction.php$ Rewr

Categories : PHP

Using .htaccess file in Apache
Using .htaccess files slows down Apache. If you can, modify the main server config file (usually called httpd.conf) From the manual: You should avoid using .htaccess files completely if you have access to httpd main server config file. Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance. http://httpd.apache.org/docs/current/howto/htaccess.html. On the other hand if you want to discuss or argue the performance loss versus the loss of ease of maintenance see this post by Simon Greenhill and his benchmarking results.

Categories : Performance

Apache .htaccess rewrite
This one should work. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule .*$(?<!.(css|jpg|gif)) index.php [L,R] All extensions must be sparated by |.

Categories : Apache

Apache, .htaccess - Not working locally
Try this code : RewriteBase /mysite/ RewriteRule ^(.+?)$ /user_home.php?domain=$1 [L,QSA] You just have to add a RewriteBase with the path of the root folder of your website.

Categories : PHP

apache htaccess file rules
I'm pretty sure that the <Limit> directive is processed at the connection time, before the URL is even read to be processed by the rewrite rule. Thus, the <Limit> is applied without regard to the URL in use (rewrite or no).

Categories : Apache

Using apache .htaccess to rewrite "/" as ".html"
You can use %{REQUEST_FILENAME} variable for the second time, capturing the file name: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}.html -f #new line RewriteCond %{REQUEST_FILENAME}.html .*/(.*)/? RewriteRule ^folder/ folder/%1 [NC,R=301,L] update Put this before the previous block RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^folder/(.*)/ folder/$1 [NC,R=301,L]

Categories : Apache

Apache Redirects - .htaccess - ReWriteCond
Try this: RewriteCond %{REQUEST_URI} !.(gif|jpg|css|js|ico|png)$ [NC] RewriteCond %{REQUEST_URI} !^/(sitemap.html|includes(/.*|))$ [NC] RewriteRule ^ /sitemap.html [R=301,L] Sure both RewriteCond lines can be combined into 1 but I would suggest keeping it 2 separate as this is easier to read and easy to maintain in case you want to add new extensions or new directories for exclusion in future.

Categories : Apache

Valid apache mod_rewrite in .htaccess
Yes, and actually, if you are not serving other, independent domains but those ones, and your new foobar.com is on a different server, you could just remove those RewriteCond. On the other hand, if you are serving in the same server the new domain, and you want that all other possible domains to be redirected to www.foobar.com (which I think it may be your case), you could try instead: RewriteCond %{HTTP_HOST} !(^www.foobar.com) [NC] RewriteRule ^(.*)$ http://www.foobar.com/$1 [R=301,NC,L] That way, you don't have to worry that you may be forgetting some other domain to redirect.

Categories : Apache

apache .htaccess redirect - clean url
Try this: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} ^/([^/]+)?/?([^/]+)?/?([^/]+)?/? [NC]

Categories : Htaccess

Apache htaccess URL rewrite guidance please
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^(www.)?(aaa|eee|uuu).com$ [NC] RewriteRule ^ http://www.aaa.com%{REQUEST_URI} [R=301,L]

Categories : Apache

Rewrite URL .htaccess - Apache server
The mod_rewrite module is issuing a redirect to your browser rather than transparently rewriting the url, causing you to see the new url in your browser. Try removing the http://domain.com portion from your RewriteRule to see if it avoids the redirect to your browser by changing the rule to: RewriteRule ^([0-9]+)-([^.]*).html$ /economy/article.php?id=$1 [L] If that fails, you could also use the proxy flag [P] to force apache to transparently fetch the page and return it to your users without the redirect. I don't recommend this approach since it can have security implications but it should work if the above doesn't. EDIT: To clarify, rewriting the url with a fully-qualified domain rather than a relative uri tells apache that the redirect is on a different server, and therefore it does

Categories : Apache

Convert apache htaccess to nginx RewriteEngine
Try this: location / { rewrite ^/playlist/(.+).txt$ /video.php?action=playlist&file=$1 last; rewrite ^/([a-z0-9]{32})/([a-zA-Z0-9/+=]+)/([0-9]{1}).(flv|mp4)$ /video.php?url=$2&base64=1&action=play&sec_hash=$1&quality=$3 last; rewrite ^/([a-zA-Z0-9/+=]+)/([0-9]{1}).(flv|mp4)$" /video.php?url=$1&base64=1&action=play&quality=$2 last; rewrite ^/download/([a-z0-9]{32})/([a-zA-Z0-9/+=]+).(flv|mp4)$ /video.php?url=$2&base64=1&action=download&sec_hash=$1 last; rewrite ^/download/([a-zA-Z0-9/+=]+).(flv|mp4)$ /video.php?url=$1&base64=1&action=download last; rewrite ^/([a-zA-Z0-9/+=]+).jpg$ /video.php?url=$1&base64=1&action=thumb last; }

Categories : Nginx

apache mod_rewrite not working with .htaccess file
Not sure if this is the cause of your problems, but you shouldn't mess with the <Directory /> Options FollowSymLinks AllowOverride None </Directory> line, and it should be something like: <Directory /> Options FollowSymLinks AllowOverride None Deny from all </Directory> You should add the directory of your document root as a different container: <Directory /var/www/html/> Options FollowSymLinks AllowOverride All Allow from all </Directory>

Categories : Linux

apache .htaccess: hiding subdomain redirect
This is only possible if you enable mod_proxy on the Apache that is hosting www.mydomain.com. Once that is enabled have rules like this in your .htaccess: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteRule ^experiential/(.+?)/?$ http://subdomain.mydomain.com/$1 [P,L,NC]

Categories : Apache

How would I make Apache case insensitive using .htaccess?
add CheckSpelling on to your .htaccess file of course after enabling the RewriteEngine so the final code will be RewriteEngine on CheckSpelling on I guess it is the best and safest way. dont forget to change AllowOverride none to AllowOverride All inside your httpd.conf file, to allow .htaccess files to work correctly.

Categories : Apache

Apache Redirect Working even when htaccess is removed
Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / ## hide .php extension # To externally redirect /dir/foo.php to /dir/foo RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s([^.]+).php [NC] RewriteRule (?!^index.php$)^.*$ /%1 [R,L] # To internally forward /dir/foo to /dir/foo.php RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}/$1.php -f RewriteRule ^(.+?)/?$ /$1.php [L]

Categories : PHP

mod rewrite in apache server and htaccess file
In Apache 2.x, it's normal to just use the .so. For example: LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so In Apache 1.x it was necessary to AddModule module.c after loading the shared library .so.

Categories : Apache

Apache supposedly ignoring htaccess directive?
Is the .htaccess file in one of the user directories? If so, then the problem may be that you need to specify AllowOverride in your apache configuration. See http://httpd.apache.org/docs/2.0/howto/htaccess.html for more info.

Categories : Htaccess

Git gui defauling to user directory instead of repo directory
I think you have ran git init into C:/Users/username. Your entire user directory is now considered a git repository. That's why git gui is showing all your files as 'Unstaged Changes'. You have to remove the C:/Users/username/.git directory, or move it into C:/Users/username/git/repo-name.

Categories : GIT

how to Block a directory with .htaccess?
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteRule ^folder(/(?!page.php$).*|)$ - [R=404,L,NC]

Categories : Regex

.htaccess difficulties with directory
^nl/provincies/plaatsen/(.*)$ section.php?sid=plaatsend&plaats=$1 ...this will never match the URL you've given? Anyway what you're looking for is something like: RewriteRule ^(.+)/provincies/([^/]+)$ section.php?sid=plaatsend&plaats=$2 RewriteRule ^(.+)/provincies/.+/plaats/(.+)$ section.php?sid=plaatsend&province=$2 Or more generic: RewriteRule ^(.+)/provincies/([^/]+)(/plaats/)?(.+)?$ section.php?sid=plaatsend&province=$2&plaats=$4&locale=$1 For complex rewriting like this I would however sincerely recommend doing it in PHP.

Categories : Regex

directory problems when using htaccess
I think your issue is probably more the way you're linking the stylesheet. You're re-writing to /dogs/ and I'm guessing your stylesheet is linked like <link href="stylesheets/style.css" rel="stylesheet" type="text/css">. So when you point your browser at /dogs/ it's trying to load a stylesheet in relation to the URL, and it looks like /dogs/ is a folder so it's just appending stylesheets/style.css to your current URL. The best bet in my opinion would be to link absolutely to the stylesheet like: <link href="/testblog/stylesheets/style.css" rel="stylesheet" type="text/css">

Categories : Htaccess

.htaccess rules in a sub directory
Try this code: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /test/ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.*)$ control.php?path=$1 [L] </IfModule>

Categories : PHP

Force https for particluar URLs using Apache htaccess
You almost got it right. Just some small corrctions: # Forcing HTTPS RewriteCond %{HTTPS} !=on [OR] RewriteCond %{SERVER_PORT} 80 RewriteRule ^wp-admin/|wp-login.php https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] Also make sure these rules are right at top before any other WP rule.

Categories : Regex

apache htaccess map first segment as parameter without disturbing other parameters
Using the QSA flag in your rule will append the current query string to the rewritten form.

Categories : Apache

apache htaccess codeigniter query string to path
try put this .htaccess in same directory with your index.php RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index.php|images|robots.txt) RewriteRule ^(.*)$ /index.php/$1 [L]

Categories : PHP

Apache 2 mod_rewrite and PHP. Modify $_SERVER['REQUEST_URI'] value from htaccess?
First of all you made a mistake of not putting L or PT flag in your first rule. Your code should be like this: RewriteRule ^hello$ goodbye [PT] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^ index.php [L] Once that code is there access this variable in index.php: $_SERVER["REDIRECT_URL"] This will have value: /goodbye EDIT If you have mod_proxy enabled on your host, you can have your first rule as: RewriteRule ^hello$ /goodbye [P] And then you will have: $_SERVER["REQUEST_URI"]=/goodbye

Categories : PHP

Apache 2.2 .htaccess File Migration - Regex Error
Instead of using this: RedirectMatch 301 ^/test/products/?$ http://www.domain.com/products/ We used this instead. This did not produce an error. RedirectMatch 301 ^/test/products/(.*)$ http://www.domain.com/products/$1

Categories : Regex

How to get parent folder in htaccess?
Try this code: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/((?:css|js|img)/.+)$ /themes/$1/$2 [L,NC]

Categories : Htaccess



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.