Questions tagged [uri]

A "Uniform Resource Idendifier" identifies a resource on a network.

Filter by
Sorted by
Tagged with
5 votes
1 answer
113 views

l() is printing "http://node/16" when gets "/node/16" as argument

This site was copied to a new domain when it started breaking. Is there some setting somewhere I need to update, so it knows how to build working URLs again?
Joren's user avatar
  • 2,440
5 votes
2 answers
4k views

How to check if page exists using page alias in D7?

In D7, how do I check whether a page exists by page alias? I've found some guy asking the same very question but I have problems with using menu_valid_path() (or drupal_valid_path() in D7) function. ...
Ari Linn's user avatar
  • 557
5 votes
3 answers
1k views

How can I restrict external URLs in link field to allow only certain domains?

After creating a Link field and use the Link with service icon format, I find out that there is no option to restrict external URLs to external domains that I want For example, if I only want to allow ...
MrIssue's user avatar
  • 75
5 votes
1 answer
7k views

How to get language prefix in Drupal 8 [duplicate]

I am building internal in my custom module that I am porting to Drupal 8: https://www.drupal.org/project/taxonomy_facets I need to get a current language prefix so I can prepend it to the link. I ...
Darko Kantic's user avatar
5 votes
3 answers
2k views

How to access all images uri in node's field in custom module?

I already know I can get an url for field of node this way: $src = file_create_url($node->get('name_of_image_field')->entity->uri->value); The problem is, my field name_of_image_field ...
PolGraphic's user avatar
  • 1,100
5 votes
4 answers
13k views

Passing Argument from URL in Panel to View Pane or Block

I have a page where I want to display all resources for a course grouped by taxonomy term. The courses are organic groups and the resources are materials belonging to those groups. I'm using panels to ...
Ben's user avatar
  • 1,030
5 votes
2 answers
361 views

Build StackExchange-style url's

I'm looking for a way to build what I call 'StackExchange style' url's with Drupal 7. In my definition, that means: A node has a path alias containing both a unique identifier and the node title. For ...
marcvangend's user avatar
  • 14.9k
5 votes
2 answers
5k views

D7 - How to get mlid value from path of menu item

Quick question. How to get mlid value from path of menu item. There is a function called menu_link_load() but it requires an mlid value, but I need something exacly the same function using path.
David's user avatar
  • 917
5 votes
5 answers
3k views

How do I build Breadcrumbs for a certain node?

In a node preprocess hook I am getting breadcrumbs for the currently viewed node by doing the following: $vars['breadcrumb'] = Drupal::service('breadcrumb') ->build(Drupal::routeMatch())->...
reekris's user avatar
  • 459
5 votes
1 answer
6k views

How to make Drupal 8 use only relative URLs?

I'm trying to get my site to use only relative URLs, like in the question drupal.stackexchange.com/questions/105932 EDIT 3: It seems like Drupal 8.0.3 and beyond will do this by default: https://www....
RaisinBranCrunch's user avatar
5 votes
1 answer
204 views

Is there an opposite / reverse of entity_uri()?

I understand that entity_uri() generates a uri for a profied entity http://api.drupal.org/api/drupal/includes--common.inc/function/entity_uri However, is it possible to go the other way? is there a ...
David Barratt's user avatar
5 votes
1 answer
112 views

Register an object with the Service Container and give it a setRequest() (get base url)

I'm looking for a way to get the hostname of a multisite, and I've found several answers about it. One of the solutions was to use: Answer link $host= \Drupal::request()->getHost();   or \...
chalo's user avatar
  • 431
5 votes
2 answers
1k views

Ampersand does not get urlencoded and breaks my GET parameters

I am using views to create a dynamic url that contains some parameters. Unfortunately I am including the node title as a parameter and it just so happens that many of the titles contain &. So my ...
Perisdr's user avatar
  • 689
5 votes
1 answer
269 views

Make variables outside of node available to pathauto

I'm trying to port a website over to Drupal 7. The structure consists of locations which have an entity reference to a region which has an entity reference to a country: location<-region<-...
Chris Leather's user avatar
4 votes
5 answers
18k views

How can I get the URL to the public files directory?

I can get the path to the public files directory by using Filesystem::realpath: $path = $filesystem->realpath('public://'); But how can I get the URL of public://?
Tim's user avatar
  • 1,387
4 votes
3 answers
8k views

Disable Clean Url in database

I am migrating a site from Apache to IIS. When I backed up the database Clean Urls was active, now my links do not work and I have to add ?q= to them! Some links work well but the Admin pages are ...
AmirHossein's user avatar
4 votes
3 answers
9k views

Path alias tokens and node references

I'm trying to figure out if path aliases are even capable of what I'm trying to do, or if I need some other sort of module. I have a content type "project" and a content type "mockup". A "project" ...
Matthew's user avatar
  • 245
4 votes
2 answers
165 views

Prevent "→" from being written in URL alias

When the post title contains "→," it will be written in the URL alias. When using Boost, an URL containing "→" will not be well cached; visitors will see the uncached node. How do I prevent the "→" ...
Mark Zulkarbaid's user avatar
4 votes
4 answers
5k views

Right URL rewrite after 404 redirect

Is it possible to rewrite the url in a 404 redirect according to the page which is actually being displayed ? For example, if the non-existent url "/fzenk" is requested, and you have configured the ...
B2F's user avatar
  • 937
4 votes
2 answers
23k views

How to get the url from uri, uri given as string

I have a string $directory = "/home/ .../sites/default/files..." I tried to get the absolute url with: $MYURL = Url::fromUri("base://".$directory); That leads to an exception! Can anybody ...
maen's user avatar
  • 460
4 votes
2 answers
2k views

how do display 404 while the url didn't exits

I add a view contains three display page,and the page urls are: questions questions/my questions/unanswered but when I visit the url questions/s12dsdd ,It display the questions page list all ...
bluesky_still's user avatar
4 votes
1 answer
6k views

how to add link to null path in menu in drupal 7

I have added superfish menu in menu bar in that one of the link have sub-link. How to add a sub-link with null path. Please help me. Thanks
asalug's user avatar
  • 187
4 votes
1 answer
6k views

Path (URL) to call custom module function

I am developing a custom module and I need an URL that would trigger an action when called. The purpose is for an external server to call this address passing some variables through $_REQUEST['...
Naoise Golden's user avatar
4 votes
2 answers
12k views

How can I programmatically create a link/URL with querystrings set from parameters?

In Drupal 8 I customize the filter in the block in the sidebar menu. When the user clicks on the option in the block, I need to pass his choice to the URL. $this->args = \Drupal::request()->...
badm's user avatar
  • 313
4 votes
3 answers
1k views

How do I make ugly URLs such as "/index.php?main_page=about_us"?

I'm converting a Zen Cart site to Ubercart and need to keep Zen Cart’s ugly URLs for SEO purposes. The site is top ranking on Google Search for their keywords and I’ve been advised that changing the ...
Jiminy Cricket's user avatar
4 votes
1 answer
4k views

How to create a URL to an unmanaged public file in Drupal 8

I'm running into a problem creating a URL to an unmanaged file in the "public" file directory (this is for the file_example for Drupal 8). The following code will throw an exception: use Drupal\Core\...
Torenware Networks's user avatar
4 votes
4 answers
8k views

How to get taxonomy by URL alias?

I have a grade vocabulary with a 6. Class taxonomy term. The taxonomy page have an URL like www.example.com/foo/6-class/bar and I can't find the taxonomy with the following code. $grade = arg(2); $...
Jurik's user avatar
  • 208
4 votes
3 answers
5k views

How I can force enable clean url d7

Today i have transferred my d7 site to a new ubuntu vps, then in the Apache config files i made this change: AllowOverride None to AllowOverride All and now d7 site is working under clean url. While ...
rakibtg's user avatar
  • 1,324
4 votes
2 answers
6k views

Dealing with absolute paths while on localhost

I have a long-term path problem while developing modules. For instance I have the following project path http://localhost:8888/mylocalproject, which (on the production server) would be http://www....
drupal_stuff_alter's user avatar
4 votes
3 answers
1k views

How do I jump to a specific place on a page?

I wish to be able to jump to a specific place on a given page. I have inserted <a name="placetojumpto"></a> into the text of the page, and set the link to the page to be "about_us/...
Cosma's user avatar
  • 41
4 votes
2 answers
1k views

Path configuration in media gallery module

I am using Media gallery module to create gallery and pathauto module to generate URL. For a gallery page I use this pattern for URL photo-gallery/[node:title] When user will click on any photo. I ...
Rupesh Pawar's user avatar
4 votes
1 answer
2k views

How do I hide /sites/default/files from URLs?

I want to upload files to their normal directory under /sites/default/files/. So let's assume I have example.pdf uploaded to sites/sites/default/files/manuals/example.pdf. I want the links to files ...
Mołot's user avatar
  • 21.9k
4 votes
4 answers
5k views

Can Webforms include the URL they were submitted from in their emails?

I have a bunch of webforms in blocks on taxonomy pages. It would be helpful for the recipient of the resulting emails to know what taxonomy page the user was on at the time they wrote their query. Do ...
Kirk Twist's user avatar
4 votes
2 answers
402 views

Clean URLs with multi-site only with suffixes / sub-folders

In D7 Multisite, I'd like to use clean URLs. However, these sites share the same domain but have different folder names. For example, the login pages would are currently https://domain.ext/red/?q=...
Rick's user avatar
  • 2,984
4 votes
1 answer
3k views

How do I modify the query parameters?

I want to modify query parameters used when accessing a Drupal page. I tried implementing hook_url_inbound_alter(), but it only allows to parse/modify the path, and it doesn't allow any interaction ...
ajmedway's user avatar
  • 141
4 votes
1 answer
2k views

referencing/linking to an entityform and passing nid/other field information through the URL

Thanks in advance for any help with this - I feel a bit like I'm down a rabbit hole. I know there must be several ways to do this, but I'm running into some obstacles. I'm trying to set up an event ...
elliphant's user avatar
4 votes
2 answers
2k views

Setting up regex-style rewrite rules within Drupal?

I have a couple of legacy rewrite rule redirects that I've traditionally put in .htaccess. For instance, paths are of the format: story/[story:title] And paths like: story/[story:nid] redirect to ...
aendra's user avatar
  • 1,755
4 votes
2 answers
12k views

The requested URL /node was not found on this server

I am setting up Drupal locally in my Ubuntu. I used drush to download and install Drupal 7. (using mysqladmin to create the database and the user) All worked well, I have the default homepage, but ...
George Katsanos's user avatar
4 votes
5 answers
3k views

Using the URI to highlight menu items

I have a content type on my site called "Articles". I created a view that lists the nodes of this content type. It's path is "/articles" For that view, I created a menu item in my main menu, "...
caseyamcl's user avatar
  • 247
4 votes
2 answers
2k views

Linking to other nodes

I'm looking to add a field to a content type that lists nodes. Basically, I need that users are able to choose the node they want to link to, and then (in the template) output the link to that node. ...
Russ Back's user avatar
4 votes
1 answer
238 views

OG homepage URL

My current/default group front page is groupname/node/nid But this is quite ugly, and when clicking on the site title the user is redirected to /group which does not display the group node but only ...
Sean McRaghty's user avatar
4 votes
2 answers
142 views

URL aliases and bidirectionality

I have responsibility for a number of Drupal 6 and Drupal 7 sites and I'm curious about a difference I've noted among them. URL aliasing is enabled on all of the sites, so that a user who navigates ...
tparks53's user avatar
4 votes
5 answers
5k views

Add custom URL to Image on a node

I'm using Drupal 7, and my nodes have an image and a weblink in seperate fields, The weblink is using the link module so not sure if that will complicate things here. (if so I could downgrade the link ...
Purplemonkey's user avatar
4 votes
2 answers
751 views

index.php is added in front of paths for anonymous users

I have a new Drupal 8.0.4 site running on Nginx, and I just noticed that the paths for anonymous users have a superfluous index.php in front of them. So instead of mysite.com/node/123 I get the ...
Mad Scientist's user avatar
4 votes
1 answer
1k views

How can I specify the URL alias when importing nodes into Drupal 7 (with the Feeds module)?

I'm importing a site into Drupal 7, using the Feeds module. I don't see any way to specify the URL alias for each node (which I want to control on most every page). How can I do this? (If the Feeds ...
iconoclast's user avatar
  • 1,809
4 votes
1 answer
1k views

Calendar view: Making year+month exposed filter go to the right URL

Using the calendar module, I've created a monthly calendar: The built-in navigation using << Prev and Next >> links works great, and correctly navigate to the previous and next ...
Druvision's user avatar
  • 2,528
4 votes
1 answer
183 views

Running simpletest tests with clean urls on nginx

Having Drupal 7 on nginx with enabled clean urls. nginx config: location @drupal { rewrite ^/(.*)$ /index.php?q=$1 last; } When trying to run tests getting message: You are not authorized to ...
Alex's user avatar
  • 161
4 votes
5 answers
4k views

How do I pass a checkbox value to a Webform through URL?

When I click a webform link, I want one of the checkbox checked. I've set already set up the default value for that checkbox as %get[foo] in Webform. I tried: a href="node/34?foo=checked" a href="...
Jessica K's user avatar
  • 126
4 votes
1 answer
470 views

Custom language negotiation module not working

I'm writing a custom module to allow the use of language a language suffix (of the form -eng or -fra) rather than the standard prefix. I'm using the language's configured prefix and have a number of ...
Eric Goodwin's user avatar
4 votes
1 answer
404 views

Drupal 7 doesn't allow search in chinese character

I'm using drupal 7 multilanguage site. When I enter chinese character (UTF8) in search box and search, it gives error like below: Bad Request Your browser sent a request that this server could not ...
vences's user avatar
  • 620

1
2
3 4 5
23