View Issue Details

IDProjectCategoryView StatusLast Update
0005613mantisbtfeaturepublic2017-02-09 10:45
Reporterryandesign Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status acknowledgedResolutionopen 
Product Version1.0.0a2 
Summary0005613: Support a really simple "view" URL
Description

I'd like Mantis to support an optional really simple "view" URL. I thought somebody would have requested this already, and I thought bug 0004137 ("Support a simple 'view' URL") would be it, but the definition of "simple" there is different than mine. I want to be able to have a Mantis installation for example at http://www.example.com/mantis/ and to be able to access bug 123 by visiting http://www.example.com/mantis/123 . I've already written a patch and would be happy to provide it.

Tagspatch
Attached Files
5613-really-simple-url.patch (2,332 bytes)   
Index: config_defaults_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v
retrieving revision 1.281
diff -u -r1.281 config_defaults_inc.php
--- config_defaults_inc.php	7 Aug 2005 13:42:03 -0000	1.281
+++ config_defaults_inc.php	7 Aug 2005 17:38:16 -0000
@@ -1095,6 +1095,11 @@
 	# eg. for bugnote: a link would be bugnote:98
 	$g_bugnote_link_tag			= '~';
 
+	# --- Bug view URL ---------------
+	# if you want a shorter / different bug view URL you can change this
+	# and then write some appropriate mod_rewrite rules.
+	$g_bug_view_url = 'view.php?id=%d';
+
 	# --- Bug Count Linking ----------
 	# this is the prefix to use when creating links to bug views from bug counts (eg. on the main
 	# page and the summary page).
Index: core/string_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/string_api.php,v
retrieving revision 1.75
diff -u -r1.75 string_api.php
--- core/string_api.php	7 Aug 2005 15:29:07 -0000	1.75
+++ core/string_api.php	7 Aug 2005 17:38:16 -0000
@@ -494,14 +494,14 @@
 	# return the name and GET parameters of a bug VIEW page for the given bug
 	#  account for the user preference and site override
 	function string_get_bug_view_url( $p_bug_id, $p_user_id = null ) {
-		return 'view.php?id=' . $p_bug_id;
+		return sprintf( config_get( 'bug_view_url' ), $p_bug_id );
 	}
 
 	# --------------------
 	# return the name and GET parameters of a bug VIEW page for the given bug
 	#  account for the user preference and site override
 	function string_get_bugnote_view_url( $p_bug_id, $p_bugnote_id, $p_user_id = null ) {
-		return 'view.php?id=' . $p_bug_id . '#'. $p_bugnote_id;
+		return string_get_bug_view_url( $p_bug_id, $p_user_id ) . '#'. $p_bugnote_id;
 	}
 
 	# --------------------
@@ -510,7 +510,7 @@
 	# The returned url includes the fully qualified domain, hence it is suitable to be included
 	# in emails.
 	function string_get_bugnote_view_url_with_fqdn( $p_bug_id, $p_bugnote_id, $p_user_id = null ) {
-		return config_get( 'path' ) . string_get_bug_view_url( $p_bug_id, $p_user_id ).'#'.$p_bugnote_id;
+		return config_get( 'path' ) . string_get_bugnote_view_url( $p_bug_id, $p_bugnote_id, $p_user_id );
 	}
 
 	# --------------------
5613-really-simple-url.patch (2,332 bytes)   

Relationships

has duplicate 0013301 closedatrol Feature request: more convenient issue URLs 
has duplicate 0022341 closedatrol Short/Pretty URLs support in MantisBT 
related to 0008987 acknowledged Mantis SEO .htaccess 

Activities

vboctor

vboctor

2005-05-16 22:50

manager   ~0010149

Please attach the patch to this issue and we will look into it. I would see this as a shortcut to the standward way of viewing issues (i.e. through view.php). Depending on how portable is the patch, we may decide to use it as more than just a shortcut.

ryandesign

ryandesign

2005-08-07 13:45

reporter   ~0011101

My my, how time flies. Here's the patch finally. Very simple. Merely exposes a config option that an administrator can modify if she wants a different bug-view URL. Then something like mod_rewrite is used to internally redirect that URL back to the view.php file. I should probably still write a patch for the documentation explaining the feature and giving an example. Like this:

Add to config_inc.php:

$g_bug_view_url = '%d';

Add to httpd.conf or .htaccess:

RewriteEngine On
RewriteRule ^([0-9]+)$ view.php?id=$1 [L]

We could potentially already include an .htaccess file with these directives (though it may not work until the administrator manually adds a RewriteBase directive specific to their installation).

There are also still a few places hard-coded to use view.php (like in the RSS and relationship graph files); these will need to be changed to use the functions that exist for this purpose.

ryandesign

ryandesign

2005-08-07 13:53

reporter   ~0011102

Comments on whether the attached patch is acceptable to be committed are appreciated.

thraxisp

thraxisp

2005-08-08 18:01

reporter   ~0011121

The patch looks reasonable to me.

siebrand

siebrand

2005-09-12 05:07

developer   ~0011365

This is not a universal solution. The way this is submitted will give a 'Apache httpd only' solution, notwithstanding that the patch looks OK and that it may be a nice feature. IMO it's a tricky feature, because it relies on URL rewriting.

Also, as ryandesign mentions, it's not yet a complete patch.

grangeway

grangeway

2008-07-28 08:10

reporter   ~0018710

Ryan,

Could you reattach the old patch if you still have it?

Paul

siebrand

siebrand

2009-06-13 04:26

developer   ~0022137

Unassigned after having been assigned for multiple years without progress.

vboctor

vboctor

2009-06-15 03:33

manager   ~0022158

The patch should also include the docbook updates which would explain the new configuration option and the steps to do the necessary changes to .htaccess / config to achieve the simple/SEO friednly URLs.

elensule

elensule

2016-09-12 13:48

reporter   ~0054006

Sorry, what is the current status of this one? Is it planned for 2.0 to provide more convenient URLs? Thanks!

atrol

atrol

2016-09-12 15:31

developer   ~0054010

@elensule, please look at fields "Status", "Assigned To" and "Target Version" of the issue.
There you can see the current status, furthermore that no one is working on it and that it's not targetted to any version.

If you are interested in getting this feature in standard MantisBT:

Submitting a patch is always a good idea, as it increases the chances of improvement eventually making it into MantisBT core. All contributions are welcome and greatly appreciated.

Patch submissions can be made in several ways. In the order of preference:

  1. Send us a Pull Request on our Github repository [1]
  2. Attach a GIT patch to the issue
  3. Attach a Unified Diff, clearly specifying the patch's base release

Kindly avoid to upload entire modified PHP files.

Please make sure that your submissions adhere to our Coding Guidelines [2], if they don't your patch might be rejected.

[1] https://github.com/mantisbt/mantisbt
[2] http://www.mantisbt.org/wiki/doku.php/mantisbt:coding_guidelines

Kunda

Kunda

2017-02-09 10:45

reporter   ~0055617

Does the patch still work (even if it's not a universal fix and doesn't address docbook) ?