On this project I am working on, there is a portfolio and a project page.
The project page is dynamically generated using PHP, and I am trying to find a way to create a permalink to these generated pages.
So on the Portfolio page there will be entries that when clicked, it will take you to the generated project page following a template with static links (i.e. menu links, style-sheet links etc...).
So what is the best way to do this / to link to the generated content?
Note: I have tried re-write rules in htaccess but these don't seem to work.
Something like this?
http://www.website.com/index.php?id=abc
Then in PHP do this...
<?php
$id = $_GET['id'];
//do whatever you want with the id
//to add more variables to the URL use &anothervariable=abc
?>
Rewrite rules are to make the URL look more appealing, like...
http://www.website.com/p/abc
EDIT:
Make sure that you have mod_rewrite installed in Apache
Then in .htaccess...
RewriteEngine on
RewriteRule ^php/project/([a-zA-Z0-9_-]+)$ php/project.php?project=$1
Related
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
I have a Wordpress blog installed in a subfolder and I would like to replace a part of the url of the post.
Right now it is like this: http://domain.com/wordpress/{permalink-structure}
What I would like to achieve (without moving the site) is: http://domain.com/{permalink-structure}
I tried changing the site url (and followed the instructions provided by WP on how to do this), but if I do this, my front-end stops working ( I am not retrieving the posts etc through the WP-API and I work with AngularJS)
Is there an easy way to automatically modify the (by wordpress generated) url of all future posts by using a plugin or modifying the source code? Or via .htaccess?
Redirecting via htaccess is my preferred option but when I tried this, the wp-api plugin (accessible via domain.com/wordpress/wp-json/* stopped working
Just to be clear: I am not accessing the posts by the generated URLS, I retrieve them via the API and the only thing I want is that the link object in the retrieved post has a different URL.
I don't know. Just try to help. This is my solution redirect what need to redirect.
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^wordpress/wp-json/(.*)$ http://domain.com/wordpress/wp-json/$1 [R=301,NC,L]
RewriteRule ^wordpress/(.*)$ /$1 [R=301,NC,L]
you want to change wordpress domain or URL. you need to perform following steps.
1 you need to modify all url's stored in database. I prefer to use https://interconnectit.com/ tool. It is pretty good and easy.
2 Once you update all database urls then you need to login in wp-admin and just update permalink settings.
you need to check plugins too. Some plugins may get deactivated you need to activate them again.
Hope this will help.
check word press codex:
https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
you can display your word press without move your directory from sub folder to root folder and can remove sub-directory from URL.
I'm building a plugin for a WordPress Multisite, and each subsite needs an SEO friendly URL for various tabs that actually appear on the same page.
I have already written the system that detects the correct URL and shows the relevant tab using a query string, but I want to do it without a query string... here's what I mean:
Currently:
http://domain.com/subsite/?tab=contact
Will load the home page of the sub-site, but containing the content of the "Contact" tab. i.e.
if (isset($_REQUEST['tab'])) {
$tab = $_REQUEST['tab'];
// Validate $tab here
get_template_part('tab', $tab);
}
What I Need:
http://domain.com/subsite/contact
To be invisibly rewritten for ALL subsites so that it ends up showing the same content, by rewriting /subsite/whatever to /subsite/?tab=whatever
Any and all help would be greatly appreciated.
I'm not going to judge your methods as others as I know nothing about your project.
To achieve what you need, use mod_rewrite rule like this:
RewriteEngine On
RewriteRule ^subsite/(.+)$ /subsite/?tab=$1
I am trying to make a website with joomla 2.5.
Now I want to do something that the urls do not change at all.
I mean that I want that the browser address bar just show the name of the site in all of the pages.
Is there any extensions for it?
EDIT
Now my urls look like the following:
mysite.com/component/k2/66-n-t-shirt-49-detail?Itemid=0
and I want it to be like this:
mysite.com/t-shirt1
Is it possible to change it from htaccess file?
I have changed the htaccess.txt to .htaccess too but it didn't work and it just removed index.php from the url.
Wrap your site in an iframe or frameset, that will only show the frameset url.
Else you could change all the urls to post, but this will require quite an effort in jQuery and would be quite hard.
I am building a website and I will need to make it SEO friendly so, as it is now, I am using a dynamic website (PHP) and through .htaccess, I am making it appear as if the site has static pages.
To do this, I am redirecting to a php file which then displays the content.
The url looks like: www.mainpage.dk/phpfile-navigationvalue-value.htm
I am using a navigation value inside the page to render it according to which menu item is clicked.
The guy I am building this for says that a url like www.mainpage/something.html is better for SEO purporses than www.mainpage.dk/phpfile-navigationvalue-value.htm. Can anyone come with some input on this matter?
And if the regular static page is better, is there a way to make a dynamic look just like a regular static page?
PS: The reason why I want a dynamic page is that the page is going to be extended with new pages every now and then as well as updated frequently.
To make it look like a regular page you could add *.html -> alias.php?alias=*
Then check the aliases and display the proper page from PHP.
Also, how about making it :
www.mainpage.dk/phpfile/navvalue/value/ -> index.php?page=phpfile&nav=navvalue&val=value
I would discourage redirecting to a phpfile, but handle it via index.php?page=* (look line above), or something similar.
Edit:
how htaccess should look
RewriteEngine on
# [!]for `*.html` -> `alias.php?alias=*`
RewriteRule ^(.*)\.html$ alias.php?alias=$1 [NC]
# [!]for `/phpfile/navvalue/value/` -> `index.php?page=phpfile&nav=navvalue&val=value`
RewriteRule ^(.*)/(.*)/(.*)(/)?$ index.php?page=$1&nav=$2&val=$3 [NC]