I am trying to move my image gallery site from one CMS to Wordpress.
On current CMS I have page with medium size image on it with URL:
www.my-example-site.com/folder-one/subfolder-one/example-image-name.jpg.html
and another page with full resolution of same image on it with URL like this:
www.my-example-site.com/full-image/folder-one/subfolder-one/example-image-name.jpg-some-custom-keywords.html
I managed to make same address on test WP for medium size image, I created same categories with, and used same URL slug for categories.
After that, under settings --> permalinks I made custom URL structure like:
www.my-example-site.com/%category%/%postname%.jpg.html
and that made me the same urls for page with medium size image on it.
But, problem is with page with full size image on it.
Is there any way (some rewrite rule or something) to get another page to. It could be 301 redirect to something like this:
www.my-example-site.com/folder-one/subfolder-one/example-image-name.jpg.html?-some-custom-keywords.html
or anything similar, just to be able to use data as like on stardard page.
than I can use custom url check (on very top of single.php) to see if page contains "?-some-custom-keywords.html" to include file for generating that new page,
if there is no that variable to include file for generating standard post page.
Please note that there are multiple different combination for "-custom-keywords.html" suffix (about 15)
If you have any question or suggestion please ask.
Regards.
I'm guessing that these URL paths are stored in the database of your old CMS.
If so, you should be changing them there to match the standard URI of WordPress instead of rigging a way for the old paths to work.
Related
Say I have api.wordpresssite.com where I will be entering data, uploading images and so on. Then saw that I want to consume the WordPress API on another site like mysite.com.
WordPress will then assume that every link in content will be api.wordpresssite.com It will also embed images with the same URL because the links and media are absolute.
Am I supposed to process the content on mysite.com looking for links but ignoring media or is there a plugin or function that I can add to my theme to do this?
I have tried changing the base URL and while it works for links, it breaks media uploads.
There are multiple endpoints so I am thinking that even if there was a function to add, it would be too far down the line of execution to do anything.
For Example, there is the WP API, as well as JetPack, and Yoast that I am using.
There are tonnes of articles on "How to use WordPress in Laravel" but not a single article has talked about how to "normalize" the content for the site that is consuming it.
The API feels like it's only true out of the box use is to be used with some kind Javascript based front end.
What I would like is a headless WordPress API with relative URLs for content links.
I was looking for the same answer and solved it this way:
What you would need to do is set the site URL to www.remote-domain.com.
You can do this by going to WP Admin > Settings > General
Screenshot
Then on your functions.php file or somewhere you can add a filter (plugin etc.) add this filter in.
add_filter( 'rest_url', 'fix_rest_url');
function fix_rest_url( $url ) {
return $url;
}
Got the answer from: https://core.trac.wordpress.org/ticket/49146
My suspicion that no one really uses the WordPress API seems to be confirmed. Mainly on an external site.
I had to create some render methods that looked for HREF links and remap them on the content, and menus.
It still seems silly and not very polished.
Is it possible to have something like this in wordpress:
http://example.com/post/2135/post-name
without having to rewrite my current url structure which is
http://example.com/post/2135
I want to keep it, and be able to access posts both ways. With and without the post-name
is it possible to have it that way? maybe make wordpress ignore that there's the post name attached at the end?
i believe it is in the php.ini file
example,
me.com/boss
file structure
root/boss/index.php
the index.php file will auto load.
but if you are used MVC you can change the results of what is displayed.
but
can you use http://example.com.post/2135/index.php&postname=lol
So I'm using the jQuery File Upload plugin to stream videos on my site. I'm just having a bit of problems.
So I've created a database that stores some of the details of the video that is uploaded, example: size, random and unique id, description, and some other things.
Now, I want to create a page for each video that is uploaded. I can easily do this through a .php file that just grabs the file location, and so on. However, how can I make it so that when users try to access a specific video they can type in something like this in the url
mysite.com/video/random_video_id
Then grab the random_video_id from the URL and use it in my PHP script to display necessary content on the page.
I just want to know how I can make custom urls like mysite.com/video/random_video_id that will trigger the php script that will generate the content of the page.
you need to use .htaccess for making the pretty url you want use...
if you make a url mysite.com/index.php?action=video&id=random_video_id ... I assume you know how you use $_GET and basic PHP, so I wouldn't go into the coding of the script which retrieves the videoes...
I use this site to make my .htaccess files - http://searchfriendlyurls.com/
And then you just write your domain in the first input (Domain Name) and in the second (ugly url) you write "index.php?action=&id=" and in the last (pretty url) you write "/"
Hope this helps you ...
And if you want to learn more about .htacces look here
I have one dynamic website with back end control panel which contains ckEditor for data entry. ckEditor inserts images with path like: /userfiles/image1.jpg and when I call page to display on user interface it shows perfect if I access it from main url but due to some reasons few section we have to move on a sub folder and when I access same page from that subdomain it fails in displaying image.
when I checked url of the image, it shows like:
app1.mysite.com/userFiles/image1.jpg But the actual path is:mysite.com/userFiles/image1.jpg.
Is there any trick or technique to solve this?
I am using PHP.
You can define a <base> in your <head>:
http://www.w3schools.com/tags/tag_base.asp
To do ist with PHP is hard. Changing it beforehand to an absolute URL might be the best way, changing it afterwards means HTML scanning, finding the images, check wether the url is absolute or relative and change it, if needed.
My site has pages like news.php, vidoes.php, products.php etc
The data for these pages are held in a MySQL database they have id, name, description and permalink
If a name is News Article Title or Boxing Match Video they permalinks would be news-article-title and boxing-match-video
Now on the news.php page there is a list of news articles and they are linked to read-news.php with ?id= and the article id beside it.
So a link looks like this www.mysite.com/read-news.php?id=2
On my read-news page I use a GET to get the id and then data for that article comes too.
How do change the links on the news.php page to come up as www.mysite.com/read-news/news-article-title.php and the URL to display the same when reading it.
I cant seem to find a tutorial that shows exactly what I need.
Any help please
Thank you
You have to use a .htaccess file (if you are on a Apache server and do not have access to the server itself, like in a shared hosting situation)
.htaccess is a simple textfile you make and place in the directory in which it controls the access, e.g. the redirection of URL's and has a lot of usable functionality.
With this you can have your URL's rewrited without the user noticing it.
Good for SEO purposes.
More info: http://httpd.apache.org/docs/current/mod/mod_rewrite.html
If you want a quick try, automatic generation is done at
http://www.webconfs.com/url-rewriting-tool.php