diff --git a/amp.admin.inc b/amp.admin.inc
index b272f1f..dc19113 100644
--- a/amp.admin.inc
+++ b/amp.admin.inc
@@ -42,6 +42,27 @@ function amp_admin_form($form, &$form_state) {
     );
   }
 
+  // AMP URL mode.
+  $form['amp_url_format'] = array(
+    '#type' => 'radios',
+    '#title' => t('URL format'),
+    '#default_value' => variable_get('amp_url_format', 'query_string'),
+    '#options' => array('query_string' => 'Query string i.e. ?amp', 'prefix' => 'Path prefix i.e. /amp'),
+    '#description' => t('If you choose path prefix, pages will be accessed via /[path_prefix]/foo-url. If you choose query string, the url will be /foo-url?amp.'),
+  );
+  $form['amp_path_prefix'] = array(
+    '#type' => 'textfield',
+    '#title' => t("Url prefix"),
+    '#size' => 10,
+    '#default_value' => variable_get('amp_path_prefix', '/amp'),
+    '#description' => t('The prefix to be used on AMP pages. For example, a page with Url /foo-url will be accessible via /amp/foo-url. You need to clear menu cache when changing this option.'),
+    '#states' => array(
+      'visible' => array(
+        'input[name="amp_url_format"]' => array('value' => 'prefix'),
+      ),
+    ),
+  );
+
   // AMP theme settings.
   $form['amp_theme'] = array(
     '#type' => 'select',
@@ -174,14 +195,14 @@ function amp_admin_form($form, &$form_state) {
 /**
  * Submit handler for the amp_admin_form
  * Clears the Drupal cache if the AMP Library warnings display checkbox value is changed
- * 
+ *
  * @param type $form
  * @param type $form_state
  */
 function amp_admin_form_submit($form, &$form_state) {
   if (variable_get('amp_library_warnings_display', false) !== $form_state['values']['amp_library_warnings_display']) {
     cache_clear_all();
-    drupal_set_message(t('AMP Library debugging checkbox changed. Cleared cache.'));    
+    drupal_set_message(t('AMP Library debugging checkbox changed. Cleared cache.'));
   }
 }
 
diff --git a/amp.install b/amp.install
index 2a0acda..c08a733 100644
--- a/amp.install
+++ b/amp.install
@@ -48,3 +48,12 @@ function amp_requirements($phase) {
   }
   return $requirements;
 }
+
+/**
+ * Implements hook_uninstall().
+ */
+function amp_uninstall() {
+  // Delete variables.
+  variable_del('amp_url_format');
+  variable_del('amp_url_prefix');
+}
diff --git a/amp.module b/amp.module
index 717ef33..19407d2 100644
--- a/amp.module
+++ b/amp.module
@@ -62,6 +62,7 @@ function amp_menu() {
     'type' => MENU_LOCAL_TASK,
     'file' => 'amp.admin.inc',
   );
+
   return $items;
 }
 
@@ -327,6 +328,59 @@ function amp_entity_info_alter(&$entity_info) {
 }
 
 /**
+ * Helper to get the url prefix for the current url.
+ */
+function _amp_get_url_prefix() {
+  return trim(variable_get('amp_path_prefix', '/amp'), '/') . '/';
+}
+
+/**
+ * Helper to get the nid from the url.
+ *
+ * @param $amp_path
+ * @param $language
+ *
+ * @return mixed
+ */
+function _amp_get_nid_from_amp_path($amp_path, $language = NULL) {
+  // Remove amp prefix to get the requested path.
+  $path = substr_replace($amp_path, '', 0, strlen(_amp_get_url_prefix()));
+
+  // Check if we are on node/#.
+  $parts = explode('/', $path);
+  if (sizeof($parts) == 2  && $parts[0] == 'node' && is_numeric($parts[1])) {
+    return $parts[1];
+  }
+
+  // Look up the source.
+  if ($source = drupal_lookup_path('source', $path, $language)) {
+    $parts = explode('/', $source);
+    return $parts[1];
+  }
+}
+
+/**
+ * Helper to check if the content type is enabled to use AMP.
+ */
+function _amp_node_type_allowed($node) {
+  return ($node && in_array($node->type, amp_get_enabled_types()));
+}
+
+/**
+ * Implements hook_url_inbound_alter().
+ */
+function amp_url_inbound_alter(&$path, $original_path, $path_language) {
+  if (variable_get('amp_url_format', 'query_string') == 'prefix') {
+    if (amp_is_amp_request() && $nid = _amp_get_nid_from_amp_path($path, $path_language)) {
+      // Update the path.
+      $path = 'node/' . $nid;
+      // Set the active path.
+      menu_set_active_item($path);
+    }
+  }
+}
+
+/**
  * Determines whether a request should return AMP HTML.
  */
 function amp_is_amp_request() {
@@ -335,22 +389,29 @@ function amp_is_amp_request() {
   if (!isset($result)) {
     $result = FALSE;
 
-    // The current request must have '?amp' in the query string.
-    if (isset($_GET['amp'])) {
-      // Ensure that there is a node loaded from the current request, and that
-      // it is a node type which has the AMP view mode enabled.
-      $node = menu_get_object();
-      if ($node && in_array($node->type, amp_get_enabled_types())) {
-        // Do an additional check to ensure the current path is actually the
-        // node's public URI. Without this check, this function would return
-        // TRUE on the node's edit form.
-        $uri = entity_uri('node', $node);
-        if ($uri['path'] == current_path()) {
-          // Only if all of the above conditions are true is this a valid AMP
-          // request.
-          $result = TRUE;
+    switch (variable_get('amp_url_format', 'query_string')) {
+      case 'query_string':
+        // The current request must have '?amp' in the query string.
+        if (isset($_GET['amp'])) {
+          // Ensure that there is no amp page for admin urls.
+          if (!path_is_admin(current_path())) {
+            $amp_node = menu_get_object();
+          }
         }
-      }
+        break;
+
+      case 'prefix':
+        // The current url starts with /amp
+        $is_amp_path = strpos(current_path(), _amp_get_url_prefix()) === 0;
+        if ($is_amp_path && $nid = _amp_get_nid_from_amp_path(current_path())) {
+          // Load the node.
+          $amp_node = node_load($nid);
+        }
+        break;
+    }
+
+    if (isset($amp_node) && _amp_node_type_allowed($amp_node)) {
+      $result = TRUE;
     }
   }
 
diff --git a/amp.test b/amp.test
index 471628b..c8a2d39 100644
--- a/amp.test
+++ b/amp.test
@@ -6,6 +6,7 @@
  */
 
 class AmpTestCase extends DrupalWebTestCase {
+  protected $admin_user;
 
   public static function getInfo() {
     return array(
@@ -16,10 +17,28 @@ class AmpTestCase extends DrupalWebTestCase {
   }
 
   protected function setUp() {
-    // Enable AMP module.
-    parent::setUp('amp', 'composer_manager');
+    // Enable modules.
+    parent::setUp('field_ui', 'amp', 'composer_manager');
+
+    // Create Admin user.
+    $this->admin_user = $this->drupalCreateUser(array(
+        'access administration pages',
+        'administer content types',
+        'administer site configuration',
+        'administer fields',
+        'create article content',
+      )
+    );
+    $this->drupalLogin($this->admin_user);
+
     // Install the AMP theme.
     theme_enable(array('amptheme', 'ampsubtheme_example'));
+
+    // Enable AMP display on article content.
+    $this->drupalGet("admin/structure/types/manage/article/display");
+    $this->assertResponse(200);
+    $edit = ["view_modes_custom[amp]" => '1'];
+    $this->drupalPost(NULL, $edit, t('Save'));
   }
 
   /**
@@ -29,18 +48,11 @@ class AmpTestCase extends DrupalWebTestCase {
     global $base_url;
 
     // Login as an admin user.
-    $admin_user = $this->drupalCreateUser(array('administer content types'));
-    $this->drupalLogin($admin_user);
+    $this->drupalLogin($this->admin_user);
 
     // Create a node to test AMP metadata.
     $node = $this->drupalCreateNode(array('type' => 'article'));
 
-    // Enable AMP display on article content.
-    $this->drupalGet("admin/structure/types/manage/article/display");
-    $this->assertResponse(200);
-    $edit = ["view_modes_custom[amp]" => '1'];
-    $this->drupalPost(NULL, $edit, t('Save'));
-
     // Check the full display.
     $this->drupalGet('node/' . $node->nid);
     $this->assertResponse(200);
@@ -56,8 +68,10 @@ class AmpTestCase extends DrupalWebTestCase {
     // Configure AMP field formatters.
     $this->drupalGet('admin/structure/types/manage/article/display/amp');
     $this->assertResponse(200);
-    $edit = ["fields[field_image][type]" => 'amp_image'];
-    $edit = ["fields[body][type]" => 'amp_text'];
+    $edit = [
+      "fields[field_image][type]" => 'amp_image',
+      "fields[body][type]" => 'amp_text',
+    ];
     $this->drupalPost(NULL, $edit, t('Save'));
 
     // Check the warnfix messages.
@@ -68,3 +82,124 @@ class AmpTestCase extends DrupalWebTestCase {
     $this->assertRaw('PASS');
   }
 }
+
+class AmpTestUrlFormats extends DrupalWebTestCase {
+  protected $admin_user;
+
+  public static function getInfo() {
+    return array(
+      'name' => 'AMP Url formats',
+      'description' => 'Tests AMP pages using prefix /amp and query string ?amp.',
+      'group' => 'AMP',
+    );
+  }
+
+  protected function setUp() {
+    // Enable modules.
+    parent::setUp('field_ui', 'path', 'amp', 'composer_manager');
+
+    // Create Admin user.
+    $this->admin_user = $this->drupalCreateUser(array(
+        'create url aliases',
+        'access administration pages',
+        'administer site configuration',
+        'administer content types',
+        'administer fields',
+        'create article content',
+        'edit any article content',
+      )
+    );
+    $this->drupalLogin($this->admin_user);
+
+    // Install the AMP theme.
+    theme_enable(array('amptheme', 'ampsubtheme_example'));
+
+    // Enable AMP display on article content.
+    $this->drupalGet("admin/structure/types/manage/article/display");
+    $this->assertResponse(200);
+    $edit = ["view_modes_custom[amp]" => '1'];
+    $this->drupalPost(NULL, $edit, t('Save'));
+  }
+
+  /**
+   * Test the url with query string ?amp.
+   */
+  public function testAmpUrlFormatQueryString() {
+    // Login as an admin user.
+    $this->drupalLogin($this->admin_user);
+
+    // Test with query string ?amp
+    $this->drupalGet('admin/config/content/amp');
+    $this->assertResponse(200);
+    $this->assertRaw('Query string i.e. ?amp');
+    $edit = ["amp_url_format" => 'query_string'];
+    $this->drupalPost(NULL, $edit, t('Save configuration'));
+
+    // Create a node to test the url detection.
+    $this->drupalGet('node/add/article');
+    $this->assertResponse(200);
+    $edit = [
+      "title" => 'AMP Page foo test',
+      "body[und][0][value]" => 'Foo',
+      "path[alias]" => 'foo',
+    ];
+    $this->drupalPost(NULL, $edit, t('Save'));
+
+    // Check AMP page with path /amp should 404.
+    $this->drupalGet('amp/foo');
+    $this->assertResponse(404);
+
+    // Check AMP page with query string ?amp.
+    $this->drupalGet('foo', array('query' => array('amp' => NULL)));
+    $this->assertResponse(200);
+    $this->assertRaw('<html amp lang');
+
+    // Check admin UI is not an amp page.
+    $this->drupalGet('node/1/edit', array('query' => array('amp' => NULL)));
+    $this->assertNoRaw('<html amp lang');
+  }
+
+  /**
+   * Test the url with prefix /testamp.
+   */
+  public function testAmpUrlFormatPrefix() {
+    // Login as an admin user.
+    $this->drupalLogin($this->admin_user);
+
+    // Test with query string /amp
+    $this->drupalGet('admin/config/content/amp');
+    $this->assertResponse(200);
+    $this->assertRaw('Path prefix i.e. /amp');
+    $edit = [
+      'amp_url_format' => 'prefix',
+      'amp_path_prefix' => 'amptest'
+    ];
+    $this->drupalPost(NULL, $edit, t('Save configuration'));
+    menu_cache_clear_all();
+
+    // Create a node to test the url detection.
+    $this->drupalGet('node/add/article');
+    $this->assertResponse(200);
+    $edit = [
+      "title" => 'AMP Page foo test',
+      "body[und][0][value]" => 'Foo',
+      "path[alias]" => 'foo',
+    ];
+    $this->drupalPost(NULL, $edit, t('Save'));
+
+    // Check AMP page with path /amp should work.
+    $this->drupalGet('amptest/foo');
+    $this->assertResponse(200);
+    $this->assertRaw('<html amp lang');
+
+    // Check AMP page with query string ?amp should show a normal page.
+    $this->drupalGet('foo', array('query' => array('amp' => NULL)));
+    $this->assertResponse(200);
+    $this->assertNoRaw('<html amp lang');
+
+    // This should show a normal page.
+    $this->drupalGet('foo');
+    $this->assertResponse(200);
+    $this->assertNoRaw('<html amp lang');
+  }
+}
