Title: Adding Permalinks
Last modified: August 20, 2016

---

# Adding Permalinks

 *  [chaloum](https://wordpress.org/support/users/chaloum/)
 * (@chaloum)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/adding-permalinks-1/)
 * Hi
 * I having trouble adding permalinks. basically I am wanting the urls to be mysite.
   com/project/projectname
 * where project is the page and projectname is the argument
 * mysite.com/project?pn=The-project-name
 * I seem to be able to get something of a permalink running but only it the argument
   is a number. for instance this works
    mysite.com/project/1 but I have a suspicion
   this works even without using permalinks
 * but this doen’t
    mysite.com/project/projectname it just creates a page not found
   error
 * I’ve looked at a number or solutions including the codex but nothing seems to
   work
 * the code in my functions.php files is:
 *     ```
       add_filter( 'rewrite_rules_array','my_insert_rewrite_rules' );
       add_filter( 'query_vars','my_insert_query_vars' );
       add_action( 'wp_loaded','my_flush_rules' );
   
       function my_flush_rules(){
       	$rules = get_option( 'rewrite_rules' );
   
       		if ( ! isset( $rules['(projects)/[^/]+/([^/]+)/?$'] ) ) {
       		global $wp_rewrite;
       	   	$wp_rewrite->flush_rules();
       	}
       }
   
       function my_insert_rewrite_rules( $rules )
       {
       	$newrules = array();
       pagename=$matches[1]&id=$matches[2]';
       $newrules['(projects)/[^/]+/([^/]+)/?$'] = 'index.php?pagename=$matches[1]&pn=$matches[2]';
   
       	return $newrules + $rules;
       }
   
       function my_insert_query_vars( $vars )
       {
           array_push($vars, 'id');
           return $vars;
       }
       ```
   
 * anyone able to help me out with this?
 * thanks

The topic ‘Adding Permalinks’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [chaloum](https://wordpress.org/support/users/chaloum/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/adding-permalinks-1/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
