w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How do I remove the extension for an external file in my wordpress htaccess file?
Just add one line for your redirect as shown below: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^contact$ /contact.php [L] <-- New Line RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress

Categories : PHP

Wordpress compilation of a "complete" .htaccess file
Declaring "RewriteEngine On" twice will not hurt For Question2 You do not need start or end with WP I am using some extra codes for security # Disable server signature ServerSignature Off #Protect some files from direct access <FilesMatch "^(wp-config.php|php.ini|php5.ini|install.php|php.info|readme.html|bb-config.php|.htaccess|readme.txt|timthumb.php|error_log|error.log|PHP_errors.log|.svn)"> Deny from all </FilesMatch> # Disable trace track requests RewriteEngine On RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) RewriteRule .* - [F] # Deny some known bad bots RewriteEngine On RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR] RewriteCond %{HTTP_USER_AGENT} ^Bot mailto:craftbot@yahoo.com [OR] RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR] RewriteCond %{HTTP_USER_AGENT} ^

Categories : Wordpress

Java script in the wordpress subfolder not running due to .htaccess file
Try to update .htaccess file of your Wordpress like this: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_URI} !^/(smart|smart/.*)$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress Basically if user is trying to access /smart/ directory, the program flow will be not executed by front controller of Wordpress, so the rewrite rule will not match. RewriteCond %{REQUEST_URI} !^/(smart|smart/.*)$

Categories : Javascript

forced https on subdomain .htaccess file is sending wordpress admin page to parent domain
Place the following in the .htaccess for the domain # .htaccess WildCard SSL + wordpress + subdomain RewriteEngine on RewriteCond %{HTTP_HOST} ^shop.domain.com$ RewriteCond %{REQUEST_URI} !^/shop/ RewriteRule ^(.*)$ /shop/$1 RewriteCond %{HTTP_HOST} ^shop.domain.com$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(/)?$ shop/index.php [L] # BEGIN WordPress for main domain <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ RewriteRule ^index.php$ - [L] RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress

Categories : Wordpress

Deny from all in subdirectory htaccess not overriding file rules in root htaccess
You can have your Root .htaccess like this # Deny access to everything by default Order Deny,Allow deny from all # Allow access to html files <Files *.html> allow from all </Files> # Deny access to sub directory <Files subdirectory/*> deny from all </Files> There is no need for a separate .htaccess in the sub directory. You are allowing access to all html files in your .htaccess in the Root Directory and not denying it anywhere in the sub directory in the first case. Apache parses all your rules and uses the last matching rule, unlike firewalls (which uses the first rule match hit). The global rules are read first and the the specific rules later.

Categories : Apache

.htaccess and Wordpress rewriting
From the sounds of it you may need to update your Wordpress URL and Site URL in the wordpress dashboard. This should update all of your links on the website. If that doesn't work I would look into downloading the "Velvet Blues Update URLs" plugin. That will go through the database in the wp_options table and replace your old URL with your new one.

Categories : Wordpress

URL Rewriting in Wordpress htaccess
After doing some additional searching, I've found some links that may help you get started. The secret lies in WordPress's add_rewrite_ruleshook. Haven't tried these myself yet, but looks promising: http://codex.wordpress.org/Rewrite_API/add_rewrite_rule URL rewriting via Wordpress Rewrite or .htaccess [SOLVED] http://www.hongkiat.com/blog/wordpress-url-rewrite/ http://matty.co.za/2009/11/custom-url-rewrites-in-wordpress/

Categories : Wordpress

htaccess and WordPress problems
Those aren't exceptions, those are "the request MUST be images/javascripts/stylesheets/etc in order to redirect", so you've got it backwards. You want a ! in there: RewriteCond %{REQUEST_URI} !(images|javascripts|stylesheets|css|images-globa|js-global|js|htm|html) RewriteRule (.*)$ http://www.domain2.com/$1 [R=301,L] Though I'm assuming you're way overreaching with the regular expression there, some of those look like you are matching against only the extension, so: RewriteCond %{REQUEST_URI} !(images|javascripts|stylesheets|css|images-globa|js-global) RewriteCond %{REQUEST_URI} !.(js|html?|png|je?pg|gif)$ [NC] RewriteRule (.*)$ http://www.domain2.com/$1 [R=301,L]

Categories : Wordpress

wordpress: htaccess redirect url
You don't want to use Redirect in conjunction with mod_rewrite, just stick with mod_rewrite. Replace the Redirect with: RewriteRule ^my_site/blog/cat/hello-world/ /my_site/cat/hello-world/ [L,R=301]

Categories : Wordpress

WordPress .htaccess RewriteRule not working
While this doesn't directly answer your question, I've had better luck using the Redirection plugin for this sort of thing. It's pretty easy to use, and when I'm doing a redesign or changing site structure I use this plugin for a few months (until the search engines have re-indexed the site). Of course, you can leave it on indefinitely if you wish.

Categories : PHP

.htaccess changes in WordPress that would add aliases to URLs
Intially set permalink settings as post name. Settings -> Premalinks. Go to the page in which you want to change the ending portion of url, click on edit which is just below the title and change the name there. Hope it will help you.

Categories : Wordpress

rewriting urls in wordpress .htaccess
Aparat from .htaccess file, you must set proper URL in Wordpress settings. See also: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

Categories : Wordpress

Adding 410 to page in .htaccess in Wordpress
you don't want the http://example.com part in the pattern, that's not part of the URI that's used for the pattern to match against You don't need the =410 in the flags The URI is already decoded by the time mod_rewrite rules get applied, so you don't want (I'm assuming) the URL encoded string. Try: RewriteRule ^ыBуги/ - [G,L] RewriteRule ^ÐÑакÑи/ - [G,L]

Categories : Wordpress

htaccess redirect 2 wordpress installations
This problem sometimes occurs. You can check this link to make your things workout for you. http://www.themesrush.com/how-to-fix-the-redirect-loop-error-in-wordpress/

Categories : Wordpress

set subfolder as domain in wordpress using htaccess
Log into Wordpress and go to Settings -> General. Change Wordpress URL to be http://www.example.com/wordpress. Log into FTP create workpress directory. Drag all wordpress related files to Wordpress directory.

Categories : Wordpress

Change permalink structure with htaccess - wordpress?
Straight answer is NO, you must not do this via .htaccess. Wordpress already supports (and enforces) this permalink structure so it is much better and cleaner to goto Wordpress admin panel and change the permalink structure to /%postid%/%postname%/ in the newer installation of Wordpress. PS: Note that even if you rewrite these URLs differently via mod_rewrite, WP will enforce and expect this to whatever is defined in it permalink definition.

Categories : Wordpress

wordpress change to friendly URL with variable using htaccess
Add this to your .htaccess rules RewrieCond %{QUERY_STRING} !no-redir [NC] RewrieCond %{QUERY_STRING} uid=([^&]+) [NC] RewriteRule ^(.*/edit-profile)/$ $1/%1 [R=301,NC,L] RewriteCond %{REQUEST_FILENAME} !-d # not a dir RewriteCond %{REQUEST_FILENAME} !-f # not a file RewriteRule ^(.*/edit-profile)/(d+)$ $1/?uid=$2&no-redir [NC,QSA,L] This would redirect /forum/edit-profile/?uid=1 to /forum/edit-profile/1 and back. EDIT : (with wordpress rules they should go like) <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /forumengine/ RewriteRule ^index.php$ - [L] RewrieCond %{QUERY_STRING} !no-redir [NC] RewrieCond %{QUERY_STRING} uid=([^&]+) [NC] RewriteRule ^(.*/edit-profile)/$ $1/%1 [R=301,NC,L] RewriteCond %{REQUEST_FILENAME} !-d # not a dir Rewri

Categories : Wordpress

wordpress site ignoring sub directory when htaccess present
I just tested a setup based off of your question. Here's an example of the hierarchy from what I could gather in your post: public_html/ (all WP install files here) public_html/admin/ (here I created a new folder similar to your question) public_html/admin/index.php (test file - just echos a line of text) public_html/admin/.htaccess (currently blank) So my .htaccess within the new subdir that's spawned off of the WP root is blank. I'm not sure what kind of auth things would/should be in there. If I access "website/admin/" - the test line echos just fine. I don't see any 404s. Could you maybe provide a little more detail so I can try to better replicate the issue you're seeing?

Categories : Wordpress

Avoiding Wordpress .htaccess rules on specific folder
You don't need multiple .htaccess you can put all the rules on the WordPress main .htaccess: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !^folder RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress Use either: RewriteRule ^folder/start.php$ /folder/index.php [R=301,L,NC] Or Redirect 301 /folder/start.php http://www.domain.com/folder/index.php Don't forget to change folder to your actual folder name.

Categories : Wordpress

Remove someone else's website URL (which contains forward slashes) via .htaccess on WordPress
Use the following rewrite rule RewriteRule ^(.*)/http:.*$ $1 [L,NC,QSA,R=301] Assuming you want www.example.com/property1/property2/http:/www.anothersite.com/ to be redirected to www.example.com/property1/property2. Use the following to end the url with / RewriteRule ^(.*/)http:.*$ $1 [L,NC,QSA,R=301]

Categories : Wordpress

.htaccess URL rewrite after migrating from Wordpress to Expression Engine
You may find it helpful to turn on Apache Server's rewrite log while you tinker with this. I think you are looking for something like this: RewriteRule ^index.php/blog/[0-9]+/[0-9]+/(.*)$ /blog/article/$1 [R=301]

Categories : Regex

How to render a page on a WordPress website for a subdomain using htaccess
Try this: RewriteCond %{HTTP_HOST} !^(www). [NC] RewriteCond %{HTTP_HOST} ^(.*).example.com [NC] RewriteRule (.*) http://www.example.com/countries/%1/$1 [L] It will also redirect india.example.com/test.html to www.example.com/india/test.html

Categories : PHP

Slim Framework proper htaccess setup with wordpress
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} ^/api/ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ api/index.php [QSA,L] RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>

Categories : PHP

Htaccess Redirect not working in wordpress with WHMCS-WP Integration
A few things: You need to remove the leading slash in your rule's target. It's going to get interpreted as an absolute URL-path and the /test/ URI base won't be used You have to escape (using a backslash) your %'s in the target. Mod_rewrite's going to interpret those as backreferences You need to use the NE flag, so that the %'s don't get encoded: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /test/ RewriteRule ^billing/client-area/$ billing/?whmcsportal\%5Bpage\%5D=whmcs\%3A\%2F\%2Fwww.thesmarttech.com\%2Fclientarea.php [L,NE] </IfModule> Also, make sure those rules are in the htaccess file in the /test/ directory.

Categories : Htaccess

Wordpress on Heroku - permalinks not working even with rewrite rules in .htaccess
Fixed it. Since my blog was placed at http://www.mysite.com/blog/ and not at http://www.mysite.com/, the .htaacces file should look like this: Options -Indexes # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog/ RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /blog/index.php [L] </IfModule> # END WordPress

Categories : Wordpress

.htaccess / mod_rewrite.c : CakePHP application in a subfolder where the root folder hosts a Wordpress installation
The following works for mydomain.com/cakeapp: (0) .htaccess in ROOT FOLDER #Action php /cgi-php52/php #AddHandler php52 .php # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^cakeapp/(.*)$ /cakeapp/$1 [L,QSA] RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress (1) .htaccess in the CAKEAPP-Folder <IfModule mod_rewrite.c> RewriteEngine on RewriteBase /cakeapp RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </IfModule> (2) .htaccess in the ROOT/CAKEAPP/APP-Folder <IfModule mod_rewrite.c> RewriteEngine on RewriteBase /cakeapp RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$

Categories : Wordpress

How prevent browser from caching XML file served by Apache? (My htaccess file is included)
I discovered the answer but I'm not sure why it's required and how to change this behavior in Apache. If I unlink (i.e. delete) the XML file first and then recreate it (instead of just writing over it), then both browsers see the fresh version! //This causes a fresh version unlink( $xmlFileLocation ); //Now creating it will result in a non-cached version being sent $f = fopen( $xmlFileLocation, "wb" ); fwrite(, $xmlFileLocation, $xml ); fclose( $xmlFileLocation ); If I do the above without unlink, then it gets changed and the modified date is updated on disk, but Apache continues to serve the old version!! Why?

Categories : Xml

Subdomain Points to Subfolder and need .Htaccess to Redirect to a Wordpress Multi-Site Sub-Site
Well, depending on your provider, you can point your subdomain towards the same directory of your top level domain, i.e.: example.com -> /public_html/ this.example.com -> /public_html/ But your question is not clear about what you are trying to do. Is it a subdomains network or is it a subfolders network? If subdomains, try to change the directory your subdomain points to as in the example above, and create the blog inside wp-admin/network/ If subfolders, then you don't need the subdomain, unless you really want to redirect it to a subfolder just like an easier to remember shortcut, in that case you don't need a RewriteRule, WP takes care of the virtual subfolder.

Categories : Wordpress

How to stop .htaccess redirect from .html file to a .php file?
Firstly, you don't need a .htaccess file. An .htaccess file is simply for overwriting the server's httpd.conf file at a user-controllable and restricted level without allowing the user full control of the server's config file. If you're not using it for anything you can delete it. Because you had 301 redirects in your .htaccess file before they're likely cached by your browser (even though you deleted them from the .htaccess file). To disable a rule you can add a # comment tag in front of it. Additionally you can delete the rule. Until the redirect rules are removed, the server would send the header request for the redirect. Once it's been removed (but it's in your cache) you will need to delete your browser's cache to make the redirect stop happening. You can keep the .htaccess file

Categories : Htaccess

htaccess rewriterule to send a file to another file in the same directory
If you want to have this rule for IP: 123.456.789.10 then you shouldn't have this IP with negation like: RewriteCond %{REMOTE_HOST} ! Try this code: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase /subdir/ RewriteCond %{REMOTE_HOST} ^123.456.789.10$ RewriteRule ^index.html?$ index.php [NC,R=302,L]

Categories : Apache

File not found with .htaccess file on Apache server
I finally solved it but in a way that I am not sure I like. At least it works. If someone has a better solution I would be glad to see it. RewriteRule ^login/([0-9]+)/([0-9]+)$ http://host/webserv/login.php?par1=$1&par2=$2 The reason I don't like this solution is because I does not give a pretty url. It just redirects. I still do not understand why I get the root directory appended to the request if I instead write: RewriteRule ^login/([0-9]+)/([0-9]+)$ login.php?par1=$1&par2=$2

Categories : PHP

htaccess redirect file request of one to another file
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} ^(subdomain).(site.com)$ [NC] RewriteRule ^file.txt$ http://%2/file-%1.txt [L,R=301,NC] EDIT: RewriteCond %{HTTP_HOST} ^(subdomain).(site.com)$ [NC] RewriteRule ^file.txt$ /file-%1.txt [L,NC]

Categories : Regex

Htaccess file does not change file extensions
Below I have pasted the url rewriting code necessary to chop off extensions manually, which should be in .htaccess file in the directory of your website that you would like to rewrite the extensions for. RewriteEngine On RewriteRule horses.htm Xu8JuefAtua.htm This simply displays the horses.htm page as Xu8JuefAtua.htm in the address bar. To rewrite a url to not need the file extension and be case insensitive, then this is the code you are looking for: RewriteEngine On RewriteRule ^horses/?$ Xu8JuefAtua.html [NC] The regular expression ^ means the beginning of the URL path, the ? means that the preceding character, in this case a slash in not necessary. The $ matches the end of the url. Smashing Magazine gives a great writeup on the .htaccess file and how to use Regular ex

Categories : HTML

Please take a look at this .htaccess file
This code is faulty and is not going to work: RewriteCond %{HTTP_HOST} www.junkwize.com/home-Garden%20Clearance RewriteRule (.*) http://www.junkwize.com/services/garden-clearance-london [R=301] Reason is that RewriteCond %{HTTP_HOST} can only match host name. Replace that code with this: RewriteRule ^home-Garden Clearance/?$ /services/garden-clearance-london [R=301,L,NC]

Categories : Htaccess

Rewrite file url to different file using htaccess?
You cannot securely hide a css file from the client if you want to use it on at least 1 page. You can use the referer header to redirect to a 404-page if it is not set, but: this header can be spoofed in some cases it is set anyways using developer tools, it would still be visible when viewing the request there You could set up a very smart system that would generate an unique id for every request, and would only show the css file if that id matches an id that is currently authorized to see that page, but: using developer tools, it would still be visible when viewing the request there Your stylesheet is requested from the browser to apply style to your text, and therefore it will always be possible to forge a request with that browser to see the contents of the file (or the output

Categories : Wordpress

Can Anyone Decipher a .htaccess File?
The redirect is probably being done by wordpress, since a request for a resource that doesn't exist will get trapped by the conditions: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d and the request gets routed through /index.php, which sees that the request is asking for something that's not there and redirects the browser to the root. You can redirect as long as the rules are before any wordpress rules. Not sure why you have so many wordpress blocks that do essentially the exact same thing, you only need one of them. But before any of them, you can add the rule: RewriteCond %{HTTP_HOST} ^YourDomain.com$ [OR] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /index.html RewriteRule ^(index.html)?$ http://www.YourDomain.com/ [L,R=301]

Categories : Wordpress

URL rewriting via my .htaccess file
You can't match against the query string in a RewriteRule statement, you need to use a RewriteCond and the %{QUERY_STRING} variable: RewriteEngine On RewriteCond %{QUERY_STRING} ^id=([0-9]+)$ RewriteRule ^$ /%1? [L] The ? is needed in the rule's target to remove the query string.

Categories : Htaccess

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

How to include php file in .htaccess?
You can try auto_append_file, as follows php_value auto_append_file "footer.php" That would have the effect of including footer.php after every PHP script, which I think is what you want? There is also auto_prepend_file, which will include the specified script before each request.

Categories : PHP

How to write .htaccess file
How about this? RewriteRule ^secure/([a-zA-Z0-9]+)/([0-9]+)/([a-zA-Z0-9-_.]+)$ secure.php?hash=$1&timestamp=$2&file=$3 [NC,L] The complete .htaccess file: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^secure/([a-zA-Z0-9]+)/([0-9]+)/([a-zA-Z0-9-_.]+)$ secure.php?hash=$1&timestamp=$2&file=$3 [NC,L] </IfModule> The file should be placed in the webroot of your site.

Categories : Regex



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