View Issue Details

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

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 and to be able to access bug 123 by visiting . I've already written a patch and would be happy to provide it.



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 




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.



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.

2005-08-07 13:46


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)   


2005-08-07 13:53

reporter   ~0011102

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



2005-08-08 18:01

reporter   ~0011121

The patch looks reasonable to me.



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.



2008-07-28 08:10

reporter   ~0018710


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




2009-06-13 04:26

developer   ~0022137

Unassigned after having been assigned for multiple years without progress.



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.



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!



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.




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) ?

Issue History

Date Modified Username Field Change
2005-05-16 20:11 ryandesign New Issue
2005-05-16 22:50 vboctor Note Added: 0010149
2005-08-07 13:45 ryandesign Note Added: 0011101
2005-08-07 13:46 ryandesign File Added: 5613-really-simple-url.patch
2005-08-07 13:53 ryandesign Note Added: 0011102
2005-08-07 13:53 ryandesign Assigned To => ryandesign
2005-08-07 13:53 ryandesign Status new => assigned
2005-08-08 18:01 thraxisp Note Added: 0011121
2005-09-12 05:07 siebrand Note Added: 0011365
2008-03-19 19:17 ryandesign Relationship added related to 0008987
2008-07-28 08:10 grangeway Note Added: 0018710
2009-06-13 04:26 siebrand Note Added: 0022137
2009-06-13 04:26 siebrand Assigned To ryandesign =>
2009-06-13 04:26 siebrand Status assigned => new
2009-06-15 03:28 vboctor Tag Attached: patch
2009-06-15 03:33 vboctor Note Added: 0022158
2009-06-15 03:33 vboctor Status new => acknowledged
2011-09-13 15:01 atrol Relationship added has duplicate 0013301
2016-09-12 13:48 elensule Note Added: 0054006
2016-09-12 15:31 atrol Note Added: 0054010
2017-02-08 09:47 atrol Relationship added has duplicate 0022341
2017-02-09 10:45 Kunda Note Added: 0055617