I finally found. If you're checking the core you will see all filters https://core.trac.wordpress.org/browser/tags/3.5/wp-includes/link-template.php. For custom post types it's post_type_link
filter and for posts it's post_link
. There are a lot of useful stuff, if you're going to read the code. The solution for my problem is :
define( 'SERVER_ROOT', 'http://' . $_SERVER['SERVER_NAME'] );
define( 'INSTALL_URL', site_url() );
add_filter( 'post_type_link', 'pleasure_post_links', 99 );
function pleasure_post_links( $permalink ) {
return str_replace( INSTALL_URL , SERVER_ROOT, $permalink);
}
The code above will make the link http://domain.com/wordpress_folder/custom_post_type
to http://domain.com/custom_post_type
.
Also you might need this in your root .htaccess ( in the root folder, not wordpress folder )
RewriteEngine On
RewriteRule ^blog([^'"]+)?$ ./wordpress_folder/blog/$1
Where blog is the custom post type name and wordpress_folder is the instalation folder of wordpress
I hope it will be useful for somebody, i almost spend two days looking for a solution