Skip to content

Instantly share code, notes, and snippets.

@landsman landsman/.htaccess_nette
Last active Jan 29, 2017

Embed
What would you like to do?
Wordpress on same domain and url with other app
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
# wordpress
# hp, clanky, rubrika, tagy
RewriteRule ^magazin wordpress/index.php [L]
RewriteRule ^magazin/ wordpress/index.php [L]
RewriteRule ^clanky-o-hubnuti/(.*) wordpress/clanky-o-hubnuti/$1 [L]
RewriteRule ^clanek/(.*) wordpress/clanek/$1 [L]
RewriteRule ^rubrika/(.*) wordpress/rubrika/$1 [L]
RewriteRule ^stitek/(.*) wordpress/stitek/$1 [L]
# soubory
RewriteRule ^wp-content/(.*) wordpress/wp-content/$1 [L]
# admin
RewriteRule ^wp-login.php wordpress/wp-login.php [L]
RewriteRule ^wp-admin/(.*) wordpress/wp-admin/$1 [L]
RewriteRule ^wp-includes/(.*) wordpress/wp-includes/$1 [L]
# root soubory
RewriteRule ^wp-activate.php wordpress/wp-activate.php [L]
RewriteRule ^wp-blog-header.php wordpress/wp-blog-header.php [L]
RewriteRule ^wp-comments-post.php wordpress/wp-comments-post.php [L]
RewriteRule ^wp-config-sample.php wordpress/wp-config-sample.php [L]
RewriteRule ^wp-config-sample.php wordpress/wp-config-sample.php [L]
RewriteRule ^wp-cron.php wordpress/wp-cron.php [L]
RewriteRule ^wp-links-opml.php wordpress/wp-links-opml.php [L]
RewriteRule ^wp-load.php wordpress/wp-load.php [L]
RewriteRule ^wp-mail.php wordpress/wp-mail.php [L]
RewriteRule ^wp-settings.php wordpress/wp-settings.php [L]
RewriteRule ^wp-signup.php wordpress/wp-signup.php [L]
RewriteRule ^wp-trackback.php wordpress/wp-trackback.php [L]
RewriteRule ^xmlrpc.php wordpress/xmlrpc.php [L]
# www fix for nette framework
RewriteRule (.*) www/$1 [L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
# disable wordpress homepage redirecting & custom page url with prefix
function wpse_184163_disable_canonical_front_page( $redirect ) {
if ( is_page() && $front_page = get_option( 'page_on_front' ) ) {
if ( is_page( $front_page ) )
$redirect = false;
}
return $redirect;
}
add_filter( 'redirect_canonical', 'wpse_184163_disable_canonical_front_page' );
add_action( 'init', 'custom_page_rules' );
function custom_page_rules() {
global $wp_rewrite;
// Change the value of the author permalink base to whatever you want here
//$wp_rewrite->author_base = '';
// Change the value of the page permalink base to whatever you want here
$wp_rewrite->page_structure = 's/%pagename%';
$wp_rewrite->flush_rules();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.