diff --git a/core/modules/path/path.admin.inc b/core/modules/path/path.admin.inc
index c8a6963..c679737 100644
--- a/core/modules/path/path.admin.inc
+++ b/core/modules/path/path.admin.inc
@@ -187,6 +187,9 @@ function path_admin_form_validate($form, &$form_state) {
   $source = &$form_state['values']['source'];
   $source = drupal_get_normal_path($source);
   $alias = $form_state['values']['alias'];
+  $alias = trim($alias);
+  $alias = trim($alias, '/.');
+  form_set_value($form['alias'], $alias, $form_state);
   $pid = isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0;
   // Language is only set if locale module is enabled, otherwise save for all languages.
   $language = isset($form_state['values']['language']) ? $form_state['values']['language'] : LANGUAGE_NONE;
diff --git a/core/modules/path/path.module b/core/modules/path/path.module
index 563bfc7..e58e9de 100644
--- a/core/modules/path/path.module
+++ b/core/modules/path/path.module
@@ -150,6 +150,7 @@ function path_form_element_validate($element, &$form_state, $complete_form) {
   if (!empty($form_state['values']['path']['alias'])) {
     // Trim the submitted value.
     $alias = trim($form_state['values']['path']['alias']);
+    $alias = trim($alias, '/.');
     form_set_value($element['alias'], $alias, $form_state);
     // Node language (Locale module) needs special care. Since the language of
     // the URL alias depends on the node language, and the node language can be
diff --git a/core/modules/path/path.test b/core/modules/path/path.test
index 8f0406e..aba4b4d 100644
--- a/core/modules/path/path.test
+++ b/core/modules/path/path.test
@@ -104,6 +104,16 @@ class PathTestCase extends DrupalWebTestCase {
     $this->drupalGet($edit['alias']);
     $this->assertNoText($node1->title, 'Alias was successfully deleted.');
     $this->assertResponse(404);
+
+    // Create an alias with slashes at either end.
+    $edit = array();
+    $alias_with_slashes = '/'. $this->randomName(8) . '/';
+    $edit['alias'] = $alias_with_slashes;
+    $edit['source'] = 'node/' . $node1->nid;
+    $this->drupalPost('admin/config/search/path/add', $edit, t('Save'));
+    $this->drupalGet($alias_with_slashes);
+    $this->assertResponse(200, 'Alias with leading and trailing slashes is trimmed.');
+    $this->assertText($node1->title, 'Alias with leading and trailing slashes is saved.');
   }
 
   /**
@@ -157,6 +167,15 @@ class PathTestCase extends DrupalWebTestCase {
     $this->drupalGet($edit['path[alias]']);
     $this->assertNoText($node1->title, 'Alias was successfully deleted.');
     $this->assertResponse(404);
+
+    // Create an alias with slashes at either end.
+    $edit = array();
+    $alias_with_slashes = '/'. $this->randomName(8) . '/';
+    $edit['path[alias]'] = $alias_with_slashes;
+    $this->drupalPost('node/' . $node1->nid . '/edit', $edit, t('Save'));
+    $this->drupalGet($alias_with_slashes);
+    $this->assertResponse(200, 'Alias with leading and trailing slashes is trimmed.');
+    $this->assertText($node1->title, 'Alias with leading and trailing slashes is saved.');
   }
 
   function getPID($alias) {
@@ -225,6 +244,15 @@ class PathTaxonomyTermTestCase extends DrupalWebTestCase {
     $this->drupalGet($edit2['path[alias]']);
     $this->assertNoText($description, 'Old URL alias has been removed after altering.');
     $this->assertResponse(404, 'Old URL alias returns 404.');
+
+    // Create an alias with slashes at either end.
+    $edit = array();
+    $alias_with_slashes = '/'. $this->randomName(8) . '/';
+    $edit['path[alias]'] = $alias_with_slashes;
+    $this->drupalPost('taxonomy/term/' . $tid . '/edit', $edit, t('Save'));
+    $this->drupalGet($alias_with_slashes);
+    $this->assertResponse(200, 'Alias with leading and trailing slashes is trimmed.');
+    $this->assertText($description, 'Alias with leading and trailing slashes is saved.');
   }
 }
 
