Title: 404 using custom permalinks
Last modified: October 23, 2024

---

# 404 using custom permalinks

 *  Resolved [floadrmd](https://wordpress.org/support/users/floadrmd/)
 * (@floadrmd)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/404-using-custom-permalinks/)
 * Hi,
 * I attempted to set up a custom permalink on my page, but it consistently returns
   a 404 error. The website is installed in a subdirectory (/en-us/). Interestingly,
   the page functions correctly when the plugin is deactivated.
 * Any assistance you can provide would be greatly appreciated.
 * Thank you!
 * Best regards,
 * —————————————————————————————
   DEBUG DATA SECTIONArray([3151] => products/myproductpage)
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2F404-using-custom-permalinks%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [floadrmd](https://wordpress.org/support/users/floadrmd/)
 * (@floadrmd)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/404-using-custom-permalinks/#post-18091660)
 * With debug_url=1
 * Array
   ([uri_parts] => Array([lang] =>[uri] => en-us/products/myproductpage[endpoint]
   =>[endpoint_value] =>)
 *     ```wp-block-code
       [old_query_vars] => Array
           (
               [attachment] => myproductpage
           )
   
       [new_query_vars] => Array
           (
               [attachment] => myproductpage
           )
   
       [pm_query] => -
       [content_type] => -
       [version] => 2.4.3.4
       ```
   
 * )
 * 
   informations on pm_query and content_type are empty
 *  Plugin Author [Maciej Bis](https://wordpress.org/support/users/mbis/)
 * (@mbis)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/404-using-custom-permalinks/#post-18091934)
 * Hi [@floadrmd](https://wordpress.org/support/users/floadrmd/),
 * Please accept my apology for late response and inconvenience. According to the
   debug data, it seems like the language code is not properly parsed from the request
   URL. As of now, Permalink Manager is compatible only with WPML & Polylang plugins
   and no other language plugin is officially supported.
 * Could you try to manually overwrite the extracted URI parts using below code 
   snippet?
 *     ```wp-block-code
       function pm_remove_language_code( $uri_pats ) {	// Check if 'en-us' exists in the URI	if ( strpos( $uri_pats['uri'], 'en-us' ) !== false ) {		// Replace 'en-us' with an empty string		$uri_pats['uri'] = str_replace( 'en-us/', '', $uri_pats['uri'] );	}	return $uri_pats;}add_filter('permalink_manager_detect_uri', 'pm_remove_language_code');
       ```
   
 * Best regards,
   Maciej
 *  Thread Starter [floadrmd](https://wordpress.org/support/users/floadrmd/)
 * (@floadrmd)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/404-using-custom-permalinks/#post-18092684)
 * Hi Maciej,
 * Thank you very much for your reply and support.
 * The override works perfectly now. I don’t use any translation plugins; the en-
   us code is simply a subdirectory containing the WP installation.
 * Best regards,

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘404 using custom permalinks’ is closed to new replies.

 * ![](https://ps.w.org/permalink-manager/assets/icon.svg?rev=2625166)
 * [Permalink Manager Lite](https://wordpress.org/plugins/permalink-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/permalink-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/permalink-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/permalink-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/permalink-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/permalink-manager/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [floadrmd](https://wordpress.org/support/users/floadrmd/)
 * Last activity: [1 year, 7 months ago](https://wordpress.org/support/topic/404-using-custom-permalinks/#post-18092684)
 * Status: resolved